- Home /
The question is answered, right answer was accepted
destroy gameobjects within overlapsphere
overlapsphere returns an array of colliders, i want to destroy all the GameObjects attached to those colliders and i dont know how to reference the GameObject:
var dwalls : Collider[] = Physics.OverlapSphere(setmov, radius);
for (var dwall in dwalls)
{
if(dwall.transform.position == newWallPos){Destroy(dwall);}//destroy
} //List.Count
}
Answer by MountDoomTeam · Oct 09, 2012 at 06:41 PM
sorry i had this right but ill put the answer because its useful in the reference.
var dwalls : Collider[] = Physics.OverlapSphere(setmov, 4*sizeMult);
for (var dwall in dwalls) { if(dwall.transform.position == newWallPos){Destroy(dwall.gameObject);}//destroy } //List.Count
Follow this Question
Related Questions
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
How to Destroy gameObjects and deal damage within a radius except player ? 2 Answers
Destroy all Objects of a Type in Game 1 Answer
Trash Collection For Instantiated Game Object 1 Answer
How to Destroy a gameobject on collision 3 Answers