您的位置:首页 > 移动开发 > Unity3D

Unity UGUI 设置 left 、right、top、bottom

2018-02-27 14:40 344 查看
RectTransform transform = GetComponent<RectTransform>();

transform.offsetMin = new Vector2(0,42);
transform.offsetMax=new Vector2(0,-62);

通过RectTransform 的属性offsetMin,offsetMax来实现;offsetMin   是vector2(left,bottom);
offsetMax 是vector2(right,top);//如果Anchors max=(1,1),right,top要传入负数;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: