What I want is to create a game in which if I jump on top of an enemy’s head , it dies so to set this up I made an enemy and a a cube with mesh renderer off, I parented the cube to enemy gameobject. Now, how do I go on deleting the entire enemy gameobject when a collision takes place. Here’s the script I’m doing it with but nothing seems to work.
function OnCollisionStay(other:Collision){
// kill enemy (not working)
if(other.gameObject.tag=="e_killer"){
Destroy(other.gameObject.transform.parent.gameObject);
}
}
Note the tag e_killer refers to the cube parented to the enemy.