using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; public class CheeseCollector : MonoBehaviour { private int Cheese = 0; [SerializeField] private TMP_Text CheeseText; private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Cheese")) { Destroy(collision.gameObject); Cheese++; Debug.Log("Cheese:" + Cheese); CheeseText.text = "Cheese:" + Cheese; } } }