Unity 5: 2D Pathfinding

Unity 5: 2D Pathfinding

32mIntermediate2016-10-10

Authors

Jesse Freeman

Jesse Freeman

Head of Partner and Framework Marketing at Amazon

Course details

Learn how to move characters and objects from point A to B with this introduction to pathfinding in Unity 5. This training focuses on pathfinding in the 2D world: programming simple ways to connect different locations in 2D games. Jesse Freeman starts by explaining the data structures (graphs and nodes) and the A* pathfinding algorithm: the technology that makes traversal of 2D games possible. Then he shows you how to connect paths in a 2D map, and find the fastest path between two points. You'll also build a simple demo map to illustrate and test the pathfinding logic.

Learning objectives
What is A*?
Adding node classes and properties
Storing and indexing graph nodes
Building the search class
Traversing the nodes
Searching adjacent nodes
Testing the search
Building a test map
Creating and coloring a grid

Skills covered

Real-TimeGame DevelopmentUnityVisualization and Real-TimeAECProduct and ManufacturingSoftware DevelopmentDeep Dive (X:Y)

Concepts

Introduction

  • Welcome
  • Exercise files

Pathfinding Introduction

  • What is A
  • Setting up the project

The Node Class

  • What is a node
  • Adding the node property

The Graph Class

  • What is a graph
  • Storing the node
  • Indexing the nodes
  • Testing for neighbors

The Search Class

  • Building the Search class
  • Starting the search
  • The Step method
  • Traversing the nodes
  • Continuing the search
  • Searching adjacent nodes
  • Getting the node index

Testing the Search

  • Building a test map
  • Running the search
  • Creating a grid in Unity IU
  • Changing colors on the grid
  • Showing the path

Conclusion

  • Next steps
40,000 Toman