Pathfinding for Our Game Characters

There are a number of secondary characters in the game that will either follow or chase the player (or robot) in the Game. There are a number of options for Unity3D developer including an option for Pro owners. I don’t own a Pro version yet so that is not really an option for me.

Looking at the Asset store, there are a number of options, including Aaron Granbergs’s A* Pathfinding. Its has a lot of great different graphs to choose from like Grid, Navmesh and List. For our game, we are currently using the List graph.

The List graph is so easy to use, and you can create it a couple different ways. The first way is to create a Parent GameObject with a bunch of Child GameObjects attached to it. All you need is the Transform. In the configuration for the List graph, drop the Parent GameObject into the Root property of the A* object and you are good to go.

You can also use the Tag name of a GameObject to create the List graph. This is what we are doing. In our Level Editor we created a PathNode Brush where we can place a Node anywhere on the Level. Then when it is created at Runtime, after the Nodes are placed on the Playing Field we Scan the List Graph to update the Paths. Super easy!

See the screenshot below to see the Path in action, the blue lines are the paths, the green line is the current path to its final destination.