public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); //ensure it! ensureComponents(); //Reload music _music.LoadMusicFiles(); //Create ui if (_ui == null) _ui = _gameObject.AddComponent<MusicUI>(); }
public override void OnLevelUnloading() { if (_gameObject != null) MonoBehaviour.Destroy(_gameObject); if (_injector != null) MonoBehaviour.Destroy(_injector); if (_ui != null) MonoBehaviour.Destroy(_ui); _gameObject = null; _injector = null; _ui = null; base.OnLevelUnloading(); }
public void ReloadUI() { if (_ui != null) { MonoBehaviour.Destroy(_ui); _ui = _gameObject.AddComponent<MusicUI>(); } }