Unity Dijkstras Pathfinding Save

Dijkstra's Pathfinding Algorithm Unity Implementation. (Not being maintained by me, it is just an experiment.)

Project README

Unity Dijkstra's Pathfinding

Note: Not being maintained by me, it was just an experiment for learning unity and c# concepts ((I may publish a complete package for this manner in future))

Dijkstra's Pathfinding Algorithm Unity Implementation.

It is the implementation of Dijkstra's Pathfinding Algorithm in Unity (Game Engine) that let's you find the shortest path between two Nodes in a Graph.

Dijkstra_Animation

In this example we are going to find the shortest path from Node A to Node F:

Sample 1

In this example we will try to follow the path using a simple Cube object:

Sample 2

Getting Started

Download

Follow one of the below ways to download the project:

  • Clone (Run the below command in Terminal or Command Prompt)
git clone https://github.com/EmpireWorld/unity-dijkstras-pathfinding.git

Usage

Editor Usage

Click on Graph object to use the Editor Integration.

Runtime Usage

You can use the Graph GetShortestPath method to get the shortest path and follow it:

Path path = myGraph.GetShortestPath ( start, end );
for ( int i = 0; i < path.nodes.Count; i++ ) {
  Debug.Log ( path.nodes [i] );
}
Debug.LogFormat ( "Path Length: {0}", path.length );

Check the Follower Script for usage example.

Resources

:speech_balloon: Forum Thread

License

MIT @ Hasan Bayat

Made with :heart: by Hasan Bayat

Open Source Agenda is not affiliated with "Unity Dijkstras Pathfinding" Project. README Source: hasanbayatme/unity-dijkstras-pathfinding