I’m coding an elaborate bomb script for a game I’m working on; however I’ve hit a bit of a problem, and am looking for the best way to select multiple objects in the scene, except that of the player/main camera etc. Simply, all enemies - though, all enemies are differently tagged (or not at all) as they all do different things, and react to the player in different ways.
I’d assumed it would be best, to select all by Tags, though this seems somewhat messy. I’m also not entirely sure how to do it. Could layers be an option?
function Bomb(){
Enemies = GameObject.FindGameObjectsWithTag("Enemy");
for (var GameObject in Enemies)
{
Destroy(GameObject);
}
}
Could something such as Enemies = GameObject.FindGameObjectsWithTag("Enemy") && GameObject.FindGameObjectsWithTag("Enemey2") etc;
work?
I have also considered arrays; but again unsure as have never dealt with accessing multiple tags at once.
Thanks in advance.