OnCollisionEnter not working?

Hello! I need some help with this issue that I don’t understand why I have…

I have a script titled “TouchDeath” to where when my Player touches the Enemy, or collide with each other, the Player will die.Now I’m using the very basic but helpful codes here:

function OnCollisionEnter( collision : Collision ) 


    if ( collision.gameObject.tag == "Player" )

I have placed the script on my Player and tagged the Enemy “player” (funny enough it works) and it has been working for a while! I’ve updated my game, done some little changes here and there, and I get a email saying they can still touch the Enemy and get away with it…

Oddly, this script has stopped working… I’ve checked the game and for some reason, there is this VERY thin line in-between my Player and my Enemy when I collide into him. This confuses me because how is the script supposed to work, when the colliders can’t seem to touch each other?!

I’m not sure what is going on and I really need some guidance on this. Much appreciated to whoever can help me! :slight_smile:

Nevermind! I have just found an answer!

Instead of using “OnCollisionEnter”, I used:

function OnControllerColliderHit(hit : ControllerColliderHit) { 
    if(hit.gameObject.tag == "Player") 

And it works fine! Since there was no collider on my Player (unless you count the Character Controller as one), there was no collision with two colliders, only a collider with the controller.

Thanks for helping out though!! :smiley: