美文网首页
Unity-UGUI动态修改 RectTransform 的Le

Unity-UGUI动态修改 RectTransform 的Le

作者: 沉麟 | 来源:发表于2019-10-25 11:00 被阅读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

相关文章

网友评论

      本文标题:Unity-UGUI动态修改 RectTransform 的Le

      本文链接:https://www.haomeiwen.com/subject/lrhsvctx.html