美文网首页
UGUI Anchor reference point 笔记

UGUI Anchor reference point 笔记

作者: silekey | 来源:发表于2021-12-03 17:03 被阅读0次

    先把 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 点.

    相关文章

      网友评论

          本文标题:UGUI Anchor reference point 笔记

          本文链接:https://www.haomeiwen.com/subject/trcmxrtx.html