UGUI基本属性设置

来源:互联网 发布:软件系统项目总结报告 编辑:程序博客网 时间:2024/06/05 18:21

RectTransform

1.top

GetComponent<RectTransform>().offsetMax = new Vector2(GetComponent<RectTransform>().offsetMax.x, top);


2.bottom

GetComponent<RectTransform>().offsetMin = new Vector2(GetComponent<RectTransform>().offsetMin.x, bottom);


3.width,height

GetComponent<RectTransform>().sizeDelta = new Vector2(width, height);


4.pos
GetComponent<RectTransform>().anchoredPosition3D = new Vector3(posx,posy,posz);
GetComponent<RectTransform>().anchoredPosition = new Vector2(posx,posy);
0 0
原创粉丝点击