- Home /
Nav Mesh Agent Type
In the Agents tab of Navigation, I created a second Agent Type, so now I have Vehicle as well as Humanoid. Looking at the Nav Mesh Agent component in the Inspector, I can see both types in the "Agent Type" dropdown menu. The problem is that if I select my new Agent Type, I get the error message: "Failed to create agent because it is not close enough to the NavMesh." If I change it back to Humanoid, everything works fine again. Any idea what I'm doing wrong?
Answer by Gustav · Oct 02, 2017 at 05:24 PM
I'm pretty sure you need to download the NavMesh component from GitHub to be able to use different agent types: https://github.com/Unity-Technologies/NavMeshComponents Too bad the error message is so misleading.
Answer by gomizako · Feb 15, 2018 at 11:51 PM
I've been playing around with this a little today, and I believe the intent is to create multiple Nav Mesh Agent types first, then when you bake your Nav Mesh, you can add different Nav Mesh Surfaces for the different Agent types. Notice that when you create new Nav Mesh Agent types, you can specify a radius, slope, step height, etc. And when adding a Nav Mesh Surface, you specify the Agent Type in there. My understanding is that the Nav Mesh Surface Data created during baking takes those agent values into account to determine where an agent can go. Then when you assign your Nav Mesh Agent a type, it will use the surface data for the corresponding type.
I created a new agent type and forgot to create a surface for it, and got the same error about not being close enough to the Nav Mesh. When I created a Surface for that agent type, it was ok. This might be why you change from Vehicle to Humanoid it works. You could try adding a surface for your Vehicle agent type to see if that helps.