As things are right now, only your player can detect collisions. For this to happen your player must have a collider attached, and be sure the IsTrigger
checkbox is unchecked. If you want to make it react to IsTrigger
than you should change your OnCollisionEnter()
to OnTriggerEnter()
.
Collisions can only be detected if at least one of the colliding objects has a call to OnCollisionEnter()
or OnTriggerEnter()
, depending on if you want the collider to react to collisions or triggers, and obviously both colliding objects must have a collider attached.
For further detail on understanding how to properly handle collision detection among your objects, please see this question.