using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PlayerStats : MonoBehaviour { public Text winsText; public Text deathText; public Text killsText; public Text description; void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { description.GetComponent().enabled = true; winsText.GetComponent().enabled = true; deathText.GetComponent().enabled = true; killsText.GetComponent().enabled = true; winsText.text = PlayerPrefs.GetInt("Wins").ToString(); deathText.text = PlayerPrefs.GetInt("Deaths").ToString(); killsText.text = PlayerPrefs.GetInt("Kills").ToString(); } } void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("Player")) { description.GetComponent().enabled = false; winsText.GetComponent().enabled = false; deathText.GetComponent().enabled = false; killsText.GetComponent().enabled = false; } } }