protected void Awake() { // Check if we already have a scene manager if (m_Instance != null) { if (Application.isPlaying) { Destroy(this); } else { DestroyImmediate(this); } Debug.LogWarning("Multiple UISceneManagers are not allowed, destroying."); return; } // Save reference in the static variable m_Instance = this; // Prepare the list if (this.m_Scenes == null) { this.m_Scenes = new List <UIScene>(); } // Prevent destruction on scene load if (Application.isPlaying) { DontDestroyOnLoad(this.gameObject); } }
protected virtual void Awake() { // Get the scene mangaer this.m_SceneManager = UISceneManager.instance; if (this.m_SceneManager == null) { Debug.LogWarning("Please add the UISceneManager to the scene."); this.enabled = false; return; } // Set the initial animation state this.m_AnimationState = this.m_IsActivated; // Get the canvas group this.m_CanvasGroup = this.gameObject.GetComponent <CanvasGroup>(); }
protected void OnDestroy() { // Remove reference m_Instance = null; }