SceneLoader.Update C# (CSharp) Method

Update() private method

private Update ( ) : void
return void
	void Update()
	{
		if (loadScene == false)
		{
			loadScene = true;
			//start the loading
			StartCoroutine(LoadNewScene());
		}
        /*
		if (loadScene == true)
		{
		}
        */
        if (async.progress == 0.9f)
        {
            //set it so when the player presses any button the level will load
            if (Input.anyKeyDown)
                async.allowSceneActivation = true;
        }
    }
	IEnumerator LoadNewScene()

Usage Example

Example #1
0
    private void Update()
    {
        for (int i = 0; i < sceneLoaderList.Count; i++)
        {
            SceneLoader loader = sceneLoaderList[i];
            bool        loaded = loader.Update();
            if (loaded)
            {
                SceneDefine.SCENE_ID id         = loader.SceneID;
                UnityScene           unityScene = UnitySceneManager.GetSceneByName(loader.Name);
                SceneBase            scene      = GameObject.Find(unityScene.name).GetComponent <SceneBase>();
                sceneList.Add(scene);

                sceneLoaderList.RemoveAt(i);

                UnitySceneManager.SetActiveScene(unityScene);
                scene.Setup(id, unityScene);
                break;
            }
        }

        for (int i = 0; i < sceneList.Count; i++)
        {
            // アンロード処理
            if (sceneList[i] == null)
            {
                sceneList.RemoveAt(i);
                break;
            }
        }
    }