diff options
author | chai <chaifix@163.com> | 2021-04-07 21:06:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 21:06:10 +0800 |
commit | c7e2d8f773baa3955f17402b842eb43329c5f3a0 (patch) | |
tree | 5ba3985d20a2908a67fefa89579f6cf3a94b6a5a /Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs | |
parent | e7dfbec8e8634e767d78959941daf71a96e021cf (diff) |
+UI_Effect
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs index 523fe50..198f48e 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/UIBehaviour.cs @@ -1,7 +1,9 @@ namespace UnityEngine.EventSystems { public abstract class UIBehaviour : MonoBehaviour - { + {
+#region Monobehaviour共有生命周期 +
protected virtual void Awake() {} @@ -15,30 +17,45 @@ namespace UnityEngine.EventSystems {} protected virtual void OnDestroy() - {} - + {}
+
+#endregion +
public virtual bool IsActive() { return isActiveAndEnabled; } #if UNITY_EDITOR + // 组件值在inspector中被修改时调用 protected virtual void OnValidate() {} + // inspector中右键reset调用 protected virtual void Reset() - {} + {}
#endif - - protected virtual void OnRectTransformDimensionsChange() - {} - +
+#region Monobehaviour回调函数 +
+ // 父节点(包括非直接父节点的祖先节点)在hierachy中的父子层级改变前调用
protected virtual void OnBeforeTransformParentChanged() {} + // 父节点(包括非直接父节点的祖先节点)在hierachy中的父子层级改变完调用 protected virtual void OnTransformParentChanged() {} +#endregion +
+#region UGUI特有回调函数 +
+ // 当gRectTransform大小改变(不包括位置)的时候回调。且如果子物体由于锚点的设置也会导致
+ // 大小改变时也会调用子物体的这个回调。如果子物体大小不会因此改变,那么不会触发这个回调
+ protected virtual void OnRectTransformDimensionsChange() + {} + + // 用animation clip修此脚本属性值的时候触发。可以用于修正动画结果 protected virtual void OnDidApplyAnimationProperties() {} @@ -46,14 +63,17 @@ namespace UnityEngine.EventSystems {} protected virtual void OnCanvasHierarchyChanged() - {} - + {}
+
+#endregion +
public bool IsDestroyed() { // Workaround for Unity native side of the object // having been destroyed but accessing via interface // won't call the overloaded == return this == null; - } + }
+
} } |