Diagram by Sebastian Lague

A* pathfinding

A very informative and easy to understand video tutorial by Sebastian Lague on how to implement and optimize A* pathfinding in Unity.

Whether or not the actual pathfinding in this tutorial is as good or optimized as it could be I do not know, but it works well and the way it is explained is excellent and it includes a lot of very cool concepts like what a heap is and how to use it to speed up the pathfinding algorithm.

The tutorial series is on youtube and is available here:

The source code for the tutorial is available from Sebastian's dropbox here:

There is an alternate version available from his github here:

The major difference between the two is that in the tutorial he creates pathfinding for 3D while the code on github is for 2D. However, the differences between the two are very small. If I were to use this system myself I would merge the two source codes together and add an toggle to the inspector letting you toggle between 2D or 3D depending on what you need for your current project.

Sebastian has a bunch of other really good video tutorials worth checking out as well.