Here is the script im not sure how to do this as every time i drag and drop the scrip to the location on unity it dosn’t work?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Itemcollector : MonoBehaviour
{
private int cherries = 0;
[SerializeField] private TMP_Text CherriesText;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Cherry"))
{
Destroy(collision.gameObject);
cherries++;
cherriesText.TMP = ("Cherries:" + cherries);
}
}
}
If you need an image of the text inspector then i’ll give
Drag and drop what? Where? If your script didn't even compile, there's nothing to drag.
– Pangamini