I’ve followed a Unity tutorial to add a collectible to my demo game but the item just won’t destroy itself.
My collectible item has Rigidbody2D and a Box Collider 2D applied. It’s set as a trigger.
My player object is tagged as “Player”.
Here’s my code:
namespace smat
{
public class Collectible : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Destroy(this.gameObject);
}
}
}
}
Can you spot an issue here? I swear it’s identical to the tutorial.