Hi, I am trying to get my trigger to destroy all objects under the same tag simultaneously. I can get it to work using a Getkey like this:
void Update ()
{
if(Input.GetKey(KeyCode.Space))
{
Destroy (GameObject.FindWithTag(“Red”));
}
}
}
but when I try to use On trigger enter it only destroys one at a time.
This is what my script looks like:
void OnTriggerEnter (Collider other)
{
Destroy (GameObject.FindWithTag(“Red”));
}
}
I am very knew to scripting. any help will be appreciated.
Thanks
What do you mean one at a time ? Is it slower thatn with the first code example ? Or is it only when you enter into each collider ?
– KiraSenseiWith the first example as soon as I press a key all game objects tagged Red are destroyed. With the trigger it will destroy one until I collide with the trigger again and then it will kill another. I want it to destroy everything at the same time.
– ninjawolf