-
Notifications
You must be signed in to change notification settings - Fork 117
Scene Types
In order to load/unload scene with uFrame, a scene must contain a single root game object that is a parent to all other game objects in the scene.
This root game object needs to have a Scene Type component attached in order to be recognized by uFrame as a root game object.
Scene Type node defines how to load a scene and allows for unloading the scene. You can create a Scene Type node in the MVVMGraph in the designer.
Example UIScene.designer.cs
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class UISceneBase : Scene {
public override string DefaultKernelScene {
get {
return "KernelScene";
}
}
public virtual UISceneSettings Settings {
get {
return _SettingsObject as UISceneSettings;
}
set {
_SettingsObject = value;
}
}
}
A scene loader is generated for every scene type that exists in the graph.
The scene loader lives as a game object on the [uFrame Kernel](uFrame Kernel). When a scene with the corresponding Scene Type is loaded, the scene loader will get a reference to the Scene Type instance and allow you to load the scene accordingly. That gives a very fine grained control on how scenes are loaded and unloaded.
Example UIScene.designer.cs
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class UISceneLoaderBase : SceneLoader<UIScene> {
protected override IEnumerator LoadScene(UIScene scene, Action<float, string> progressDelegate) {
yield break;
}
protected override IEnumerator UnloadScene(UIScene scene, Action<float, string> progressDelegate) {
yield break;
}
}