Skip to content

Pathfinding Using C# in Unity

In this four-part series of tutorials, I go in-depth to solving the pathfinding problem using C# in Unity.

Pathfinding is the plotting of the most optimal route between two points by a computer application. The most optimal path is usually associated with identifying the course that best meets the problem’s objective. It could be finding the shortest, the cheapest, the fastest, or other criteria defined by the problem between two points in an extensive network of points.

Implement a Generic Pathfinder in Unity using C#

This is the first tutorial in the series where we implement a generic pathfinder in Unity using C#. In this tutorial, we create a generic pathfinder that is algorithm agnostic. Then we create three implementations of the pathfinder using the A*, Djikstra and Greedy best-first algorithm. We apply this generic pathfinder to various pathfinding problems (8-Puzzlerectangular grid-based map and graph-based map).

Implement a Generic Pathfinder in Unity using C#

Try the WebGL Pathfinding Playground

Click on the image above to launch the WebGL pathfinding playground.

8-Puzzle Problem Using A* in C# and Unity

In this tutorial, we apply our generic pathfinder and solve the 8-puzzle problem and demonstrate the application in Unity.

2D Grid-Based Pathfinding Using C# and Unity

In this tutorial, we apply our generic pathfinder and solve the 2D grid-based pathfinding and demonstrate the application in Unity.

Graph-Based Pathfinding Using C# in Unity

In this tutorial, we apply our generic pathfinder and solve the graph-based pathfinding problem and demonstrate the application in Unity.

Detailed, fast-loading, clutter-free, no funny popups, and ad-free Tutorials