using TMPro; using UnityEngine; using UnityEngine.UI; public class DinoWinnerUI : MonoBehaviour { public TMP_Text winnerText; public Text winnerTextLegacy; bool shown; void Update() { DinoGameManager gm = DinoGameManager.Instance; if (gm == null) return; if (!gm.IsGameOver && !gm.IsMatchOver) { if (shown) { shown = false; SetText(""); } return; } if (!shown) { shown = true; } string name = gm.WinnerName.ToString(); if (string.IsNullOrWhiteSpace(name)) name = "Unknown"; string label = gm.IsMatchOver ? "Match Winner" : "Round Winner"; SetText($"{label}: {name}"); } void SetText(string value) { if (winnerText != null) winnerText.text = value; if (winnerTextLegacy != null) winnerTextLegacy.text = value; } }