void OnEnable() { if (!LayerKernel.InstanceInternal || !LayerKernel.Initialized[SceneSub.GetLayerIndex(gameObject.scene.name)]) { return; } HandleEnable(); }
protected virtual void Start() { if (!LayerKernel.InstanceInternal || !LayerKernel.Initialized[SceneSub.GetLayerIndex(gameObject.scene.name)]) { return; } if (Layer != null) { return; } Layer = LayerKernel.Layers[SceneSub.GetLayerIndex(gameObject.scene.name)]; Setup(); }
static void ChangeOp(string sceneName) { var nextScene = sceneName; LayerKernel.Initialized[SceneSub.GetLayerIndex(sceneName)] = false; Closed(); Layer.ActiveLayer.Release(); LayerKernel.LoadJobs.Add(SceneManager.UnloadSceneAsync(Layer.ActiveLayer.Scene)); LayerKernel.LoadJobs.Add(Resources.UnloadUnusedAssets()); LayerKernel.LoadJobs.Add(SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive)); Layer.ActiveLayer = null; LayerKernel.RunUnscaled(CoChangeOP()); IEnumerator CoChangeOP() { while (LayerKernel.LoadJobs.Count > 0) { yield return(0); } NextActiveSceneName = nextScene; } }