Quantcast
Channel: Answers for "A trigger to kill all parts of an enemy?"
Viewing all articles
Browse latest Browse all 6

Answer by MarkD

0
0
Well, if you want the colliders to be 'gone' from the game world and never come back, you already gave your answers yourself you simply search all the children and destroy them. var parent:Transform; Java for (var:Child in parent){ Destroy(Child.gameObject); } C# Transform parent; foreach(Transform child in parent) { Destroy(Child.gameObject); } Now note that this is made on the fly and has not been tested, but it gives you a general starting point to go from. Now if you want only to delete the scripts of the enemy but keeps all its GameObjects alive in the game you should take a look at this http://docs.unity3d.com/Documentation/ScriptReference/Component.GetComponentsInChildren.html

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images