我正在尝试使用统一的新 UI 图像系统为我的玩家实现健康。但它不起作用。任何人都可以帮助我。谢谢。
using UnityEngine.UI;
if (health_value == 3) {
GameObject.Find("health").GetComponent<Image>().color.a = 1;
GameObject.Find("health1").GetComponent<Image>().color.a = 1;
GameObject.Find("health2").GetComponent<Image>().color.a = 1;
}
我收到这个错误。
error CS1612: Cannot modify a value type return value of `UnityEngine.UI.Graphic.color'. Consider storing the value in a temporary variable