Hello,
I have a prefab named : LeftGrunt.
I use it for my spawner. Here is the code for death decision:
if(dead){
AI ai=(AI)GetComponent("AI");
//tell ai that he is dead
if(ai)ai.dead=true;
Destroy(GameObject.Find("Capsule"));
/*Destroy (gameObject);*/
}
Sadly, with this code I kill the capsules of all of my spawned units.
How can i destroy the capsule only for the unit for which the if(dead) expression proven TRUE ?
PS: “Capsule” is the child of the LeftGrunt prefab.