Testing the pathfinder

Once we hit the Play button, we should be able to see our A* pathfinding algorithm in action. By default, once you play the scene, Unity3D will switch to the Game view. Since our pathfinding visualization code draws in the debug editor view, to see the found path, you need to switch back to the Scene view or enable Gizmos visualization:

The first path found by the algorithm

Now, try to move the start or end node around in the scene using the editor's movement gizmo (not in the Game view, but the Scene view):

A second ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.