Unity-UGUI动态修改 RectTransform 的Le
2019-10-25 本文已影响0人
沉麟
obsItem.GetComponent<RectTransform>().offsetMax = new Vector2(0, obsItem.GetComponent<RectTransform>().offsetMax.y);
obsItem.GetComponent<RectTransform>().offsetMin = new Vector2(0, obsItem.GetComponent<RectTransform>().offsetMin.y);
我只修改了Left,和Right的值(左右宽适配)。
offsetMin : 对应Left、Top
offsetMax : 对应Right、Bottom