UGUI Anchor reference point 笔记
2021-12-03 本文已影响0人
silekey
先把 Unity 官方文档列出来
The position of the pivot of this RectTransform relative to the anchor reference point.
The Anchored Position is the position of the pivot of the RectTransform taking into consideration the anchor reference point. The anchor reference point is the position of the anchors. If the anchors are not together, Unity estimates the four anchor positions using the pivot placement as a reference.
这段粗体英文反复看N编,没懂,最后经过反复实验
Anchor reference point 公式如下:
x = AnchorMin.x + (AnchorMax.x - AnchorMin.x) * pivot.x
y = AnchorMin.y + (AnchorMax.y - AnchorMin.y) * pivot.y
实际上就是 Anchor reference point 就在 AnchorMin 与 AnchorMax 组成的矩形区域中, 其具体位置就是这个矩形区域的pivot 点.