ugui记录
ugui用到了RectTransform,对ugui的操作 很多体现在RectTransform上:
RectTransform rectT = go.GetComponent<RectTransform>(); if (texture.width > texture.height) { rectT.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, originalWidth); rectT.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, texture.height * originalWidth / texture.width); }
RectTransform rectT = go.GetComponent<RectTransform>(); rectT.offsetMax = new Vector2(-170, tmpY);
RectTransform rectT = txt0.GetComponent<RectTransform>(); Vector3 vec = rectT.localPosition; rectT.localPosition = new Vector3(vec.x, -70, vec.z);
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。