Now that the floor is baked and readable by the AI, it is time to delve into the nuances of AI pathfinding in Unity.

The Monster is now able to use the baked Navmesh to calculate movement.

The first thing the monster needed was a NavMesh Agent component.

--

--

Navigation Meshes (Navmeshes) are tools that dictate what a character can move on, as well as the boundaries of their movement. This tool is used for any non-player characters (NPCs).

In order to get an NPC to follow movement commands from a NavMeshAgent component, first we need to create the actual playable field for the AI.

I created a small building and placed several waypoints around, shown here as purple cylinders. To show off this setup, the roof has been temporarily removed.

We can do this by going to Window>AI>Navigation.

Opening up the Navigation window, in the Object tab, we select all of our walkable floors and check the “Navigation Static” box, and ensure that the “Navigation Area” is set to Walkable.

--

--

Jack Leavey

Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!