标签:style pixel com form one 遮罩 nta rect nsf
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
标签:style pixel com form one 遮罩 nta rect nsf
原文地址:https://www.cnblogs.com/QQW123/p/9784974.html