Ejemplo n.º 1
0
    /// <summary>
    /// Requests that the room controller loads a room with a given scene name. If the room in question has been
    /// preloaded, it will show that scene. Otherwise it will single load the scene with that name.
    /// </summary>
    /// <param name="name">The name of the room to be loaded.</param>
    public static void LoadRoom(string name)
    {
        Scene newScene = SceneManager.GetSceneByName(name);

        if (newScene.buildIndex == -1)
        {
            //SceneIsNotLoaded
            SceneManager.LoadScene(name);
        }
        else
        {
            //SceneIsLoaded
            instance.DisableScene(currentScene);
            SceneManager.SetActiveScene(newScene);
            instance.EnableScene(currentScene);
        }
    }