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