using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class WenChang : MonoBehaviour { public Material mat; private string lastText = ""; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { string nowText = gameObject.GetComponent().text; if (nowText!= lastText) { lastText = nowText; float num = float.Parse(nowText); if (num < -10 && num >= -20) { mat.color = new Color(0.55f, 0.7f, 1f, 0.6f); } } } }