Help me with this simple script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class destroy : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == “gem”)
{
Destroy(other.gameObject);
}
}
}

its supposed to destroy the gems when in touch. doesnt seem to work, can anyone help please?

Hello

Try to debug your Code. Make a breakpoint into ontriggerenter and take a look what happen.

Christoph

sorry im new, what do you men by debug and breakpoint
thanks for helping :slight_smile:

Hello

Sorry, you have to Google this words. Really. You cant work with Unity without knowing what this means.

Christoph

thanks, found out the problem, was using a box collider, not a 2Dbox collider.