Class UIBehaviour
Base behaviour that has protected implementations of Unity lifecycle functions.
Inherited Members
Namespace: UnityEngine.EventSystems
Assembly: UnityEngine.UI.dll
Syntax
public abstract class UIBehaviour : MonoBehaviour
Methods
Awake()
Called when the behaviour is loaded, before Start and before any OnEnable call.
Declaration
protected virtual void Awake()
IsActive()
Returns true if the GameObject and the Component are active.
Declaration
public virtual bool IsActive()
Returns
| Type | Description |
|---|---|
| bool | True if the GameObject is active in the hierarchy and the component is enabled. |
IsDestroyed()
Returns true if the native representation of the behaviour has been destroyed.
Declaration
public bool IsDestroyed()
Returns
| Type | Description |
|---|---|
| bool | True if the native representation of the behaviour has been destroyed. |
Remarks
When a parent canvas is either enabled, disabled or a nested canvas's OverrideSorting is changed this function is called. You can for example use this to modify objects below a canvas that may depend on a parent canvas - for example, if a canvas is disabled you may want to halt some processing of a UI element.
OnBeforeTransformParentChanged()
Called before a direct or indirect parent is reparented to a new Transform.
Declaration
protected virtual void OnBeforeTransformParentChanged()
OnCanvasGroupChanged()
Called when the state of a parent CanvasGroup is changed.
Declaration
protected virtual void OnCanvasGroupChanged()
OnCanvasHierarchyChanged()
Called when the state of the parent Canvas has changed.
Declaration
protected virtual void OnCanvasHierarchyChanged()
OnDestroy()
Called when the behaviour is destroyed.
Declaration
protected virtual void OnDestroy()
OnDidApplyAnimationProperties()
Called when an animation clip has applied its values to this behaviour.
Declaration
protected virtual void OnDidApplyAnimationProperties()
OnDisable()
Called when the behaviour becomes disabled, or its parent GameObject is deactivated.
Declaration
protected virtual void OnDisable()
OnEnable()
Called when the behaviour becomes enabled.
Declaration
protected virtual void OnEnable()
OnRectTransformDimensionsChange()
This callback is called when the dimensions of an associated RectTransform change. It is always called before Awake, OnEnable, or Start. The call is also made to all child RectTransforms, regardless of whether their dimensions change (which depends on how they are anchored).
Declaration
protected virtual void OnRectTransformDimensionsChange()
OnTransformParentChanged()
Called when a direct or indirect parent has reparented to a new Transform. See MonoBehaviour.OnTransformParentChanged for more information.
Declaration
protected virtual void OnTransformParentChanged()
OnValidate()
Called in the editor when the script is loaded or a value changes in the Inspector.
Declaration
protected virtual void OnValidate()
Reset()
Called in the editor when you select Reset in the Inspector's context menu, or when you add the component for the first time.
Declaration
protected virtual void Reset()
Start()
Called on the first frame the behaviour is enabled, just before any of the Update methods are called.
Declaration
protected virtual void Start()