How to make an enemy change tags after death.

Hi guys! My Unity3D Game is coming along nicely. Learning a bunch on the way! I was wondering is there anyway to make and enemy change its tag from “enemy” to “untagged” the enemy AI Script i have uses Health ofc is there a way to make it change tags if health reaches 0. The reason i want to achieve this is because the dead bodys are screwing my radar. If i could get any info on this it would be muchly appreciated. Thank you all in advance.

Very straightforward:

gameObject.tag = "";

This will remove the tag from the gameObject. Just drop this into your ‘death’ function.

See Unity - Scripting API: GameObject.tag

After:

dead= Instantiate(deadReplacement2, GOPos.transform.position, GOPos.transform.rotation);

Insert:

dead.tag = ‘newtag’;

Tags must be declared in the tag manager before using them.

ShotHead=true;
}

function ApplyDamage (damage : float) {
 if (hitPoints <= 0.0)
 return;
 // Apply damage
 hitPoints -= damage;
 scoreManager.DrawCrosshair();
 // Are we dead?
 if (ShotHead==true) {hitPoints=0.0;Replace();}
 else if (ShotHead==true && hitPoints >= 0.0) {hitPoints=0.0;Replace();}
 else if (ShotHead==false && hitPoints <= 0.0)Replace(); 
}

function Replace() {
 // If we have a dead barrel then replace ourselves with it!
 if (deadReplacement && ShotHead==true) {
 dead= Instantiate(deadReplacement2, GOPos.transform.position, GOPos.transform.rotation);
 scoreManager.addScore(20);
 // For better effect we assign the same velocity to the exploded barrel
 dead.rigidbody.velocity = rigidbody.velocity;
 dead.angularVelocity = rigidbody.angularVelocity;
 Destroy(gameObject);
    } 
    else {
    dead=Instantiate(deadReplacement, GOPos.transform.position, GOPos.transform.rotation);
 scoreManager.addScore(20);
 // For better effect we assign the same velocity to the exploded barrel
 dead.rigidbody.velocity = rigidbody.velocity;
 dead.angularVelocity = rigidbody.angularVelocity;
 Destroy(gameObject);
    }
 // Destroy ourselves

}


is my damage script. But i cannot seem to find where to place this little code.

gameObject.tag = "";