Unity-UGUI dynamically modifies the Left, Top, Right and Bottom values of RectTransform

It may be necessary to dynamically modify UGUI at runtime to dynamically modify the Left, Top, Right and Bottom values ​​of RectTransform at runtime. Unity provides two values.

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

**
offsetMin: corresponding to Left, Bottom
offsetMax: corresponding to Right, Top
**

Guess you like

Origin blog.csdn.net/z502768095/article/details/80606485