hello forum.
i want to destroy. No i just want to destroy a number of cloned Objects which were created on runtime with Instantiate. During the creation i tag these objects with “CurvePoint”.
I need to destroy those tagged clones by calling the function DestroyClones () during runtime. I tried to make it kinda like in the Script Reference under ‘GameObject.FindGameObjectsWithTag’ only with destroy. But i am missing something.
static function DestroyClones () {
var clones = GameObject.FindGameObjectsWithTag ("CurvePoint");
for (var i in clones) {
// this creates an error message
Destroy (clones);
// this prints 'hello' i times but destroys only one clone
//print("hello");
//var aClone = GameObject.FindWithTag ("CurvePoint");
//Destroy (aClone);
}
}
basicly i want to destroy all objects with the tag “CurvePoint”.