private void Awake() { _instance = this; _spawnController = FindObjectOfType <SongObjectSpawnController>(); if (_spawnController == null) { Console.WriteLine("Spawn controller was null"); return; } // Get notes var gameNotePrefab = ReflectionUtil.GetPrivateField <NoteController>(_spawnController, "_gameNotePrefab"); _notes = gameNotePrefab.GetSpawned <NoteController>(); if (_notes.Count > 0) { Console.WriteLine("notes found"); } else { Console.WriteLine("Notes not found"); _notes = UnityEngine.Object.FindObjectsOfType <NoteController>().ToList(); if (_notes.Count > 0) { Console.WriteLine("Notes found with Object.FindObj"); } else { Console.WriteLine("Notes not found with Object.FindObj"); } } }
//https://answers.unity.com/questions/1113318/applicationloadlevelapplicationloadedlevel-obsolet.html //buildIndex == loadedLevel public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { if (scene.buildIndex == 2) { HiddenMod.OnLoad(); } }
private void Awake() { // Get notes //var notes = ObjectPool.GetSpawned(FindObjectsOfType<GameObject>().FirstOrDefault(x => x.name == "GameNote(Clone)"), _notes, true); try { var noteForType = FindObjectsOfType <GameObject>().FirstOrDefault(x => x.name == "GameNote(Clone)"); var notes = ObjectPool.GetSpawned(noteForType, _notes, true); Console.WriteLine(notes.Count); } catch (Exception) { Console.WriteLine("Hidden: failed"); } Instance = this; }