Input points[] as destination path for agent

Hi,

How can I use an array of points[ ] to create a path and inputting this as a destination for an agent?

Thanks.

Create an Array of Transforms, set them up and then make your AI start by index 0, if your AI gets close enough, take the next index as destination.

If you want to make it the “resource right way”, use a Vector3[ ], that way you dont have to create any GameObjects with tranform which eat unnecessary resources. But do this only in case you are a bit more adv. in unity i would suggest :slight_smile:

Thanks, that is actually the way I am doing it right now (by setting Vector3’s in an array), but I was hoping if it was possible to create a path out of the points right away. This because due to the points calculated, the path may not always be valid.
So there is no way to set it as a total path, right?

You could create an Global Path Manager which at initialization calculates all possible Paths between them.

you can do so by: NavMesh.CalculatePath

each Vector3 is an identifier by itself, that way you could create a Dicctionary which
shows up “available” positions with its calculated path you can use, so no need to calculate it over and over again.

and if any of those Vector3 positions is beeing used, you could store it in another Dicctionary.

that way you have available waypoints in one dicctionary and used one in another.

A solution from unity is not available, so would have to write your own