Esempio n. 1
0
    IEnumerator StartLoadScene(string sceneName, string luaName, LoadSceneMode mode)
    {
        if (IsLoadedScene(sceneName))
        {
            yield break;
        }
        AsyncOperation async = SceneManager.LoadSceneAsync(sceneName, mode);

        async.allowSceneActivation = true;
        yield return(async);

        Scene      scene = SceneManager.GetSceneByName(sceneName);
        GameObject go    = new GameObject(m_LogicName);

        SceneManager.MoveGameObjectToScene(go, scene);
        Debug.Log(sceneName);
        SceneLogic sceneLogic = go.AddComponent <SceneLogic>();

        sceneLogic.sceneName = sceneName;
        sceneLogic.Init(luaName);
        sceneLogic.OnEnter();
    }