using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class EnviromentUIControl : MonoBehaviour { public GameObject agentObj; public TextMeshProUGUI remainTimeText; private AgentWithGun agentScript; // Start is called before the first frame update void Start() { agentScript = agentObj.GetComponent(); } // Update is called once per frame void Update() { int remainTime = agentScript.remainTime; remainTimeText.text = "RemainTime:" + remainTime.ToString(); } }