ugui记录

来源:互联网 发布:武汉软件新城,共几期 编辑:程序博客网 时间:2024/05/13 12:25

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);


0 0