/// <summary> /// Finds all GameObjects that make up the default environment and groups them into lists /// </summary> private void FindEnvironment() { if (_platformManager.allPlatforms.IndexOf(_platformManager.activePlatform) <= 0) { feet = null; playersPlace = null; smallRings = null; bigRings = null; visualizer = null; towers = null; highway = null; backColumns = null; backLasers = null; rotatingLasers = null; doubleColorLasers = null; trackLights = null; return; } sceneName = _gameScenesManager.GetCurrentlyLoadedSceneNames().LastOrDefault(x => x.EndsWith("Environment") || x == "Credits"); sceneName = sceneName == "MultiplayerEnvironment" ? sceneName = "GameCore" : sceneName; Scene scene = SceneManager.GetSceneByName(sceneName); if (!scene.IsValid()) { return; } roots = scene.GetRootGameObjects(); renamedObjects = new List <GameObject>(); FindMenuEnvironmnet(); FindMultiplayerEnvironment(); FindPlayersPlace(); FindFeetIcon(); FindPlayersPlace(); FindSmallRings(); FindBigRings(); FindVisualizers(); FindTowers(); FindHighway(); FindBackColumns(); FindBackLasers(); FindRotatingLasers(); FindDoubleColorLasers(); FindTrackLights(); foreach (GameObject go in renamedObjects) { go.name = go?.name.Remove(go.name.Length - renamedObjectSuffix.Length); } }
public static bool IsSceneInStackAndActive(this GameScenesManager gameScenesManager, string sceneName) { if (!gameScenesManager.GetCurrentlyLoadedSceneNames().Contains(sceneName)) { return(false); } Scene scene = SceneManager.GetSceneByName(sceneName); if (!scene.IsValid()) { return(false); } return(scene.GetRootGameObjects().First().activeInHierarchy); }