当前位置:网站首页>Uibehavior, a comprehensive exploration of ugui source code

Uibehavior, a comprehensive exploration of ugui source code

2022-07-06 07:50:00 Walking on the top of the clouds

UIBehaviour For all UI The base class of the component , Inherited from MonoBehavior, Have Unity The same life cycle .

UI Components are inherited directly or indirectly UIBehaviour This abstract class .

except Awake,OnEnable,Start,OnDisable,OnDestroy Outside , Contains some and ui Change related virtual methods

// When related RectTransform Call when the dimension changes 
protected virtual void OnRectTransformDimensionsChange()
{}
// Call before changing the parent 
protected virtual void OnBeforeTransformParentChanged()
{}
// When the parent is changed, call 
protected virtual void OnTransformParentChanged()
{}
// Called when animation properties are applied 
protected virtual void OnDidApplyAnimationProperties()
{}
// When the canvas group is changed, call 
protected virtual void OnCanvasGroupChanged()
{}
// Call when the canvas state changes 
protected virtual void OnCanvasHierarchyChanged()
{}
//      
public bool IsDestroyed()
{
    return this == null;
}

The parent class description of each component :

Text-->MaskableGraphic-->Graphic-->UIBehaviour

Image-->MaskableGraphic-->Graphic-->UIBehaviour

RawImage-->MaskableGraphic-->Graphic-->UIBehaviour

Button-->Selectable-->UIBehaviour

Toggle-->Selectable-->UIBehaviour

Slider-->Selectable-->UIBehaviour

ScrollBar-->Selectable-->UIBehaviour

DropDown-->Selectable-->UIBehaviour

InputFiled-->Selectable-->UIBehaviour

EventSystem-->UIBehaviour

special

ScrollView It's made up of several components , The key ScrollRect-->UIBehaviour

Panel Yes, built-in ui picture Background Of Image

原网站

版权声明
本文为[Walking on the top of the clouds]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131853287403.html