I am trying to use the following code to make my sprite disappear when touched by the main player but it doesn’t seem to work. I am new so an explanation to the answer would be appreciated.
void OnCollision2D(Collider2D Player)
{
if(collider2D.gameObject.tag == "Player")
{
Destroy (gameObject);
gameObject.renderer.enabled = false;
}
}