OnCollisionEnter is not called on Collision?!

I can’t figure out why my OnCollisionEnter function isn’t firing. I am working on a top down game and I have basic movement set up and was trying to make my player die when it collided with a gameobject that I tagged with “spike” but when they collide nothing happens. I made sure to add a rigidbody and collider to my player as well as a collider to my spikes. I even made sure to use the box collider 2D so I don’t know why it wont work!?

Welcome to the forums. In future, please can you post your script by clicking on the Code Sample buttons and pasting it there? That allows us to copy the code, if need be.

The reason your code is not working is that you have written OnCollisionEnter when you should have used OnCollisionEnter2D. It’s important to use the 2D version of rigid bodies, colliders etc in a 2D game.