Unity 5.6 Navigation System

Hello,

I’ve been getting used to new changes to the Navigation system in Unity 5.6. Unfortunately, the manual or documentation hasn’t been updated. I’m actually teaching this so any help would be greatly appreciated.

First, in the Navigation window, there is an Agents tab and a Bake tab. One is for a bake agent and the other is for non baked agents? I see that in the Nav Mesh Agent, I must select my agent type. Does the baked agent influence this in any way?

Second, In my project, I created a new agent type, gave him properties, and in the subject GameObject, I set the Agent Type to be this newly created Agent Type. Upon setting a destination in code, I got back an error. Using humanoid as the agent type, everything worked fine. I then copied the values from the Humanoid agent type to my new agent type, and it failed to work. Is there additional configuration to a custom agent type to get it to work?

Again, any help is appreciated.

Thanks!
Brian

I am also confused, but according to some of the documentation linked from the github repo that the button on the navmesh bake tab links to, you’re supposed to somehow bake navmeshes for each agent type.

https://github.com/Unity-Technologies/NavMeshComponents

Bumping

Have you guys figured this out yet? What does the “Agents” tab do?

I haven’t tried this, but going through the documentation for the package I linked, it looks like you want to create an empty gameobject with a NavMeshSurface component set for that agent, and then bake that. Probably one surface for each agent type?

I tried this and that’s the case.

Though for my needs I had to do this at runtime and when I set the agentTypeID property at runtime it always fails with a warning saying “Invalid agent type”.

Similarly I wanted also to create NavMeshAgents at runtime but the navmesh component does not even have a property to set the agentType through a script (despite the property is visible in the inspector)… so right now the only way to do this if u have more than 1 agent type at runtime is to actually set this values in prefabs with the right agenTypeID and instance them at runtime.

the agentTypeID should be exposed to API in the latest release of 5.6 (if not it’s on its way).

I believe I have the latest release. I have 5.6.0f3. I’ll explain myself better with some pictures as maybe I’m doing something wrong.

So what I found is that if I add a 2nd agent type. Then when at runtime I try to set the agentTypeID of the NavMeshSurface (the one you can get from GitHub) I get this Warning you can see below saying “Agent Type invalid.” (In this case I tried to set it to 1 as Humanoid was 0. Maybe is a wrong assumption).
3050696--228895--NavMeshSurface.png

And in the other hand when working with the NavMeshAgent (this one comes already built in) the agent type property seems not to be exposed through code (thought is visible in the inspector/editor) so it cannot be set at runtime at all.
3050696--228896--NavMeshAgentExposed.png
VS
3050696--228894--NavMeshAgentInspector.png

The agentTypeID will most likely not be 1 for the ‘TEST’ agent type. To obtain type id from index do smth along these lines:

for (int i = 0; i < NavMesh.GetSettingsCount (); ++i)
{
  var settings = NavMesh.GetSettingsByIndex (i);
  Debug.Log ("Index : " + i + " Agent Type ID : " + settings.agentTypeID);
}

The agent has the agentTypeID property in the latest patch release: https://unity3d.com/unity/qa/patch-releases?version=5.6

Great! with this patch I can do everything I need at runtime! thanks for everything!