i created a script that updates text when it has a trigger but the tutorial i was using uses normal text not textmeshpro and in the tutorial it said to drag the text under the text variable thing but i cant what do i do? code:
using UnityEngine;
using UnityEngine.UI;
public class Itemcollect : MonoBehaviour
{
[SerializeField] private Text coinText;
private int coin = 0;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Coin"))
{
Destroy (collision.gameObject);
coin++;
Debug.Log("Coin: " + coin);
coinText.text = "coins: " + coin;
}
}
}