-
Notifications
You must be signed in to change notification settings - Fork 117
Scene Types
In order to load/unload a scene with uFrame, a scene must contains a single root game object that is a parent to all other game objects in the scene.
This root game object needs to have attached a Scene Type component 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.
The scene type is a mono behaviour that will go on your root scene object. This allows uFrame to associate a game object so it can easily be destroyed when you want to unload a scene. This also allows uFrame to listen for when the scene has actually been loaded.
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 gameobject on the uFrame Kernel, when the same corresponding 'Scene Type' has been loaded, the scene loader will get a reference to the scene type and allow you to load it accordingly. This gives 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;
}
}