Unity-UGUI动态修改 RectTransform 的Left,Top,Right和Bottom值

可能某些时候需要在运行的时候动态修改UGUI动态修改 RectTransform 的Left,Top,Right和Bottom值,Unity提供了两个值。

scrollContent.GetComponent<RectTransform>().offsetMin = new Vector2(0.0f, 0.0f);
scrollContent.GetComponent<RectTransform>().offsetMax = new Vector2(0.0f, 0.0f);

**
offsetMin : 对应Left、Bottom
offsetMax : 对应Right、Top
**

猜你喜欢

转载自blog.csdn.net/z502768095/article/details/80606485