1、动态修改RectTransform的Width,Hieght值。
1) 通过其sizeDelta属性进行赋值,其中X->Width,Y->Height。
2)使用SetSizeWithCurrentAnchors函数来进行设定,其中Horizontal->宽,Vertical->高。(受锚点和中心影响)
3)使用SetInsetAndSizeFromParentEdge函数来进行设定。(不受锚点和中心影响<对齐方式,边界距离,宽度>)
2、获取RectTransform大小。
1)sizeDelta的属性值,即W*H.
2) rect的size属性。
3、使UI子物体固定距离填充父物体,通过Vertical/Horzontal Layout Group,然后打开对应的Control Child Size的Width/Height选项。
--持续更新。