using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class EconomyManager : Singleton { private TMP_Text goldText; private int currentGold = 0; const string COIN_AMOUNT_TEXT = "Gold Amount Text"; private void Start() { goldText = GameObject.Find(COIN_AMOUNT_TEXT).GetComponent(); UpdateGoldText(); } public void ResetGold() { currentGold = 0; UpdateGoldText(); } public void UpdateCurrentGold() { currentGold += 1; UpdateGoldText(); } private void UpdateGoldText() { if (goldText == null) { goldText = GameObject.Find(COIN_AMOUNT_TEXT).GetComponent(); } goldText.text = currentGold.ToString("D3"); } }