Working with Unity’s Nav Mesh System for Smart AI

addam davis
2 min readSep 14, 2021

--

Objective: How to implement using the NavMesh system into your game!

After creating the point and click movement for you character you may be aware that your character will get to that hit point no matter what you place in their way. As it stands, they will walk through objects to get there.

In your hierarchy you will see all your objects you placed in your game. Your mesh doesn’t know they exist. This is a simple fix. Select all those objects you have on the floor and mark them as static so the NavMesh Agent will know that the player should avoid them.

With your objects selected at the top right of the inspector mark static. If asked, select yes to make changed to the children.

Select navigation and clear the old NavMesh.

Bake a new NavMesh.

You will now see a rim around every object you have that the NavMesh now knows to avoid. This will make you player also avoid walking through these objects. I’ll see you in the next tutorial!

--

--