using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Counter : MonoBehaviour { public int total; private Text txt; void Start() { total =0; txt = this.GetComponent(); } void Update() { txt.text = total.ToString(); } }