using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; /// /// This class' only purpose is to set the stats string of a UI element /// [RequireComponent(typeof(TextMeshProUGUI))] public class ItemStatsDisplay : MonoBehaviour { private TextMeshProUGUI text; private void Start() { text = GetComponent(); // Because of the meta tag, Unity will make sure this exists. No sanity checks } public void SetStats(string stats) { if(text == null) text = GetComponent(); // Just in case this gets called before Start() text.text = stats; } }