I have a player and an enemy. Player has the tag PLAYER and ENEMY has the tag Enemy.
function OnCollisionEnter(collision : Collision)
{
if (collision.gameObject.tag == "Player")
{
Destroy(collision.gameObject);
}
}
This simple code does NOT work, cause what I want to happen is the player game object to be destroyed once the enemy comes in contact with the player. I tried putting the script on the enemy character prefabs etc but nothing happens.