using System.Runtime.CompilerServices; namespace BansheeEngine { /// /// Handles operations with the active scene (level). /// public static class Scene { /// /// Returns the name of the scene prefab. This is empty if scene hasn't been saved yet. /// public static string ActiveSceneName { get { return activeSceneName; } } /// /// Returns the UUID of the scene prefab. This is empty if scene hasn't been saved yet. /// internal static string ActiveSceneUUID { get { return activeSceneUUID; } } private static string activeSceneName = "Unnamed"; private static string activeSceneUUID = ""; /// /// Returns the root scene object for the current scene. /// public static SceneObject Root { get { return Internal_GetRoot(); } } /// /// Clears all scene objects from the current scene. /// public static void Clear() { Internal_ClearScene(); activeSceneUUID = null; activeSceneName = "Unnamed"; } /// /// Loads a new scene. /// /// Path to the prefab to load. public static void Load(string path) { Clear(); Prefab scene = Internal_LoadScene(path); if (scene != null) { activeSceneUUID = scene.UUID; activeSceneName = scene.Name; } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern Prefab Internal_LoadScene(string path); [MethodImpl(MethodImplOptions.InternalCall)] private static extern SceneObject Internal_GetRoot(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClearScene(); } }