I am creating an fps game, I have created the gun, the bullet, and the enemy. Now I want to make my enemy destroyed after the collision with bullet. My enemy is a gameobject named Fire and tagged Enemy and my bullet named "Cube 1(Clone)" and tagged "Cube 1(Clone)". I made a script for that:
#pragma strict
function OnTriggerEnter(theCollision : Collider)
{
if(theCollision.gameObject.name=="Cube 1")
{
Destroy(gameObject);
Debug.Log("Dead");
}
}
But it does not work.