Pathfinding - Section 2 - Pathfinding in 2D Grid

Опубликовано: 26 Июнь 2026
на канале: FaramiraSG
557
5

Welcome back to our video tutorial series on Pathfinding.

By the end of this tutorial, you will be able to:
1. model a 2D grid-based map;
2. apply pathfinding using the A*, Dijkstra and Greedy pathfinding algorithms and
3. visualise the steps of pathfinding in a 2D grid-based map.

In the first section of this tutorial, (   • Pathfinding - Section 1 - Develop a Pathfi...  ) we learned about pathfinding and the algorithms used to solve pathfinding problems. We then implemented a generic pathfinder using C# by applying the three most commonly known and popular pathfinding algorithms: the "A-star," the Dijkstra, and the greedy best-first algorithms.

In this second section, we will apply our generic pathfinder to navigate through a 2D grid, showcasing its practical application within Unity.
We will also create some additional game objects and scripts that will allow us to visualise our pathfinding-related data, including viewing the current node in one colour, the nodes in the closed list in other colours, and the addition and removal from the open list in other colours.

GitHub link: https://github.com/shamim-akhtar/tuto...

0:23 - Start of The Tutorial
1:19 - The Terminologies
2:05 - The Grid Node
3:24 - The Grid Node View
5:39 - The Grid Map
10:22 - Get Neighbours Method
13:41 - Toggling Walkable/Non-Walkable Grid Nodes
17:12 - The Cost Functions
18:15 - The Delegates for Pathfinding
19:25 - The Dummy NPC
25:40 - The Destination GameObject
27:28 - Attaching the Generic Pathfinder
33:25 - Fixed Bug - OnAddToOpenList Delegate
34:20 - See Pathfinding in Action
34:45 - Integrate All Pathfinders
36:50 - View A*, Dijkstra and Greedy Pathfinders in Action