protected virtual void OnDestroy() { if (m_Instance.Equals(this)) { m_Instance = null; } }
protected virtual void Start() { // Assign new custom ID if (this.CustomID == 0) { this.CustomID = UIWindow.NextUnusedCustomID; } // Make sure we have a window manager in the scene if required if (this.m_EscapeKeyAction != EscapeKeyAction.None) { UIWindowManager manager = Component.FindObjectOfType <UIWindowManager>(); // Add a manager if not present if (manager == null) { GameObject newObj = new GameObject("Window Manager"); newObj.AddComponent <UIWindowManager>(); newObj.transform.SetAsFirstSibling(); } } // Transition to the starting state if (Application.isPlaying) { this.EvaluateAndTransitionToVisualState(this.m_StartingState, true); } }
protected virtual void Awake() { if (m_Instance == null) { m_Instance = this; } else { Destroy(this.gameObject); } }
protected virtual void Start() { // Assign new custom ID if (this.CustomID == 0) { this.CustomID = UIWindow.NextUnusedCustomID; } // Make sure we have a window manager in the scene if required if (this.m_EscapeKeyAction != EscapeKeyAction.None) { UIWindowManager manager = Component.FindObjectOfType <UIWindowManager>(); // Add a manager if not present if (manager == null) { GameObject newObj = new GameObject("Window Manager"); newObj.AddComponent <UIWindowManager>(); newObj.transform.SetAsFirstSibling(); } } }
protected virtual void OnValidate() { this.m_TransitionDuration = Mathf.Max(this.m_TransitionDuration, 0f); // Make sure we have a window manager in the scene if required if (this.m_EscapeKeyAction != EscapeKeyAction.None) { UIWindowManager manager = Component.FindObjectOfType <UIWindowManager>(); // Add a manager if not present if (manager == null) { GameObject newObj = new GameObject("Window Manager"); newObj.AddComponent <UIWindowManager>(); newObj.transform.SetAsFirstSibling(); } } // Apply starting state if (this.m_CanvasGroup != null) { this.m_CanvasGroup.alpha = (this.m_StartingState == VisualState.Hidden) ? 0f : 1f; } }