I’m extremely new to unity and I’m trying to create a simple prototype just using a sphere (as my player, it has a 3rd person character controller but I also attached a basic sphere collider) and cubes falling from the sky attempting to “squish” the player. I want the player to be destroyed when in comes into contact with the Cube but i’m really struggling with the scripting. At the moment i’m using this:
function OnCollisionEnter(collision : Collision) {
if (collision.gameObject.name == “Player”)
Destroy (collision.gameObject);
}
But it’s not working. Please help =)