Unity干货

OnRectTransformDimensionsChange

2018-02-02  本文已影响13人  阿飞咯

This callback is called if an associated RectTransform has its dimensions changed. The call is also made to all child rect transforms, even if the child transform itself doesn't change - as it could have, depending on its anchoring.

当自身尺寸发生变化的时候回调,可用于做排版,AspectRatioFitter,运用这个原理,在OnRectTransformDimensionsChange回调中适配recttransform大小。对于父gameobject与子gameobject回调顺序是个迷,运行中是子gameobject先调用,父gameobject后调用。

上一篇 下一篇

猜你喜欢

热点阅读