check enemy existance

right, basically what I wanna do is write something like this

(pseudocode)

I can already check the distances, but how do I check if a gameObject with a specific name or tag exists?

If you can find the object to test it, then it “exists.” If you want this info, then you should probably not be calling Destroy(gameObject) on it.

If you want to tell if it is “alive,” you could just create a variable isAlive on all enemies, and set it to false when they get killed.

If you really need to call Destroy, you could have an associative array that is populated with all game objects as keys and true (initially) as values to represent what is “alive” and “dead.” As you create new objects, add their references to the array. As you destroy objects, set their values to false.

Hope this helps!