可能某些时候需要在运行的时候动态修改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
**
本文介绍如何在Unity中使用UGUI系统动态调整RectTransform组件的Left、Top、Right和Bottom值,通过设置offsetMin和offsetMax属性实现元素位置及大小的实时变化。
1180

被折叠的 条评论
为什么被折叠?



