Join Jesse Freeman for an in-depth discussion in this video Building a test map, part of Unity 5: 2D Pathfinding.
- So now that we've built our node, our graph,…and our search logic, it's time for us to test it all out.…Let's go back into Unity.…Now, inside of Unity, let's create a new C-Sharp script,…and we're gonna call this "Path Finding Test".…Next, we're gonna want to attach…the Path Finding Test to our main camera.…We'll just attach it here so we're able to run it.…Now, let's open this up inside of MonoDevelop.…In order for us to do a search, we're gonna need to create…some new map data.…
Let's create a 2D array, typed to int,…and we'll call it "Map".…In the constructor, we're gonna set up our 2D array…to be a five by five grid, and then we're gonna…prepopulate it with our map data.…For our first row, we're gonna set the values to be zero,…one, zero, zero, and zero.…Let's copy this line and paste it four more times.…On the last line, let's change the one to a zero.…As you can see, we'll have a pretty open room…with a wall along the left, middle side.…
This will give us a good test…to see if our path finding logic works.…
- 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
Skill Level Intermediate
1. Pathfinding Introduction
What is A*?58s
2. The Node Class
3. The Graph Class
4. The Search Class
5. Testing the Search
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.