What would be the best way to setup Target priority

Right now i’m messing around with AI and i want them to go through a enemies in a certain order. What would be the best way to set it up? (in C# if it makes any differents)

I had a targetting system in my spaceship game and what I did was to put all the “enemy” tagged gameobjects into a gameobject array and when player presses target next or target closest button (this is to make sure they get targetted if you instantiate some enemies from a spawner object at some point in the game) it cycles to the next target or the closest target from this array.

Like this:

var enemies : GameObject[] = GameObject.FindGameObjectsWithTag ("Enemy") as GameObject[];

I used the exact same logic in the AI but instead I set it to find the “friendly” tagged objects.

Hope this helps you.