RectTransform


1.改变RectTransform的top

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


2.改变RectTransform的bottom

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


3.改变RectTransform的width,height

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


4.改变RectTransform的pos

GetComponent().anchoredPosition3D = new Vector3(posx,posy,posz);

GetComponent().anchoredPosition = new Vector2(posx,posy);

你可能感兴趣的:(RectTransform)