首页 > 编程语言 > 详细

Unity3D — — UGUI之RectTransform

时间:2018-10-14 10:55:57      阅读:255      评论:0      收藏:0      [点我收藏+]

Mask.GetComponent<RectTransform>().anchoredPosition(子物体) = hotKey_image.rectTransform.anchoredPosition(父物体);
Mask.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, hotKey_image.GetComponent<Image>().GetPixelAdjustedRect().width);
Mask.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, hotKey_image.GetComponent<Image>().GetPixelAdjustedRect().height);

以上代码就能让两张图片大小一样并且重合,可以用来让子物体填充父物体或者作为遮罩

Unity3D — — UGUI之RectTransform

原文:https://www.cnblogs.com/QQW123/p/9784974.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!