Counter.cs 347 B

123456789101112131415161718192021
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class Counter : MonoBehaviour
  6. {
  7. public int total;
  8. private Text txt;
  9. void Start()
  10. {
  11. total =0;
  12. txt = this.GetComponent<Text>();
  13. }
  14. void Update()
  15. {
  16. txt.text = total.ToString();
  17. }
  18. }