先把 Unity 官方文檔列出來(lái)
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.
這段粗體英文反復(fù)看N編嚎货,沒(méi)懂蔫浆,最后經(jīng)過(guò)反復(fù)實(shí)驗(yàn)
Anchor reference point 公式如下:
x = AnchorMin.x + (AnchorMax.x - AnchorMin.x) * pivot.x
y = AnchorMin.y + (AnchorMax.y - AnchorMin.y) * pivot.y
實(shí)際上就是 Anchor reference point 就在 AnchorMin 與 AnchorMax 組成的矩形區(qū)域中, 其具體位置就是這個(gè)矩形區(qū)域的pivot 點(diǎn).