- Home /
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)
Can you give a bit more information on what you are trying to do? There are as much AI algorithms as developpers in the world.
Are you using the Nav$$anonymous$$esh agent? Your own implementation of some AI algorithm?
I am using simplePath to the control the movement of the AI
In this case, it is related to this package. Ask the author http://forum.unity3d.com/members/44725-alexkring.
Answer by crocodile5 · Apr 18, 2012 at 11:51 AM
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.
Your answer
Follow this Question
Related Questions
Targeting multiple tags 1 Answer
random target selection 2 Answers
Enemy AI targeting script 3 Answers
Targeting other objects of the same type but not self 1 Answer
Ai finding target after spawning 2 Answers