private static void CreateDefaultGo(GameRunningStage stage) { var go = new GameObject("DefaultGo" + stage); // go.AddComponent<Canvas>().enabled = false; MoveToStageScene(stage, go); _defaultParents[(int)_stage] = go; }
private static void MoveToStageScene(GameRunningStage stage, GameObject go) { for (int i = 0; i < SceneManager.sceneCount; i++) { var scene = SceneManager.GetSceneAt(i); if (scene.name.StartsWith(TargetScene[(int)stage])) { SceneManager.MoveGameObjectToScene(go, scene); break; } } }
public static void SetStage(GameRunningStage stage, bool clearOthers) { _stage = stage; if (clearOthers) { for (int i = 0; i < _defaultParents.Length; i++) { if (i != (int)stage) { _defaultParents[i] = null; } } } }
public static void Clear(GameRunningStage stage) { _defaultParents[(int)stage] = null; }