private void Assignations() { _noDestroy = FindObjectOfType <NoDestroy>(); _control = FindObjectOfType <FlightControl>(); _sound = GetComponent <SoundManager>(); _transition = FindObjectOfType <TransitionControl>(); }
private void Assignations() { _noDestroy = FindObjectOfType <NoDestroy>(); _musicAu = gameObject.AddComponent <AudioSource>(); _soundsAu = gameObject.AddComponent <AudioSource>(); _uiManager = FindObjectOfType <UIManager>(); _control = FindObjectOfType <FlightControl>(); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
private void Awake() { DontDestroyOnLoad(gameObject); if (_instance != null) { Destroy(gameObject); } else { _instance = this; GameObject.DontDestroyOnLoad(gameObject); } }
void OnLevelWasLoaded() { if (Application.loadedLevelName != "GameOver" || Application.loadedLevelName != "Credits") { if (nod == null) { nod = this; DontDestroyOnLoad(transform.gameObject); } else { if (nod != this) { Destroy(this.gameObject); } } } if (Application.loadedLevel == 0 || Application.loadedLevel == 1 || Application.loadedLevelName == "Credits") { Destroy(this.gameObject); } }