unity, access sprite of UGUI Image
首先需要using UnityEngine.UI;
然后调用下面语句就不报错了:
Image.GetComponent<Image>().sprite
参考:http://answers.unity3d.com/questions/794139/
获得Image的width和height:
Image.GetComponent<RectTransform>().rect.width
首先需要using UnityEngine.UI;
然后调用下面语句就不报错了:
Image.GetComponent<Image>().sprite
参考:http://answers.unity3d.com/questions/794139/
获得Image的width和height:
Image.GetComponent<RectTransform>().rect.width