(Case 936460) Custom NavMesh Agent Type causes "Failed to create agent"

Using an “Agent Type” other than the built-in “Humanoid”, causes Unity to fail at NavMeshAgent creation and outputs the following warning to the Console window:

Any call to drive the NavMeshAgent then fails as well, with errors like:

Please see the video that is attached to the bug-report.

Reproduce

  • Open user project
  • Open Assets/Scene.unity
  • Select “My Agent” in Hierarchy and notice its “Agent Type = Humanoid”
  • Press play and click somewhere in the screen

Observe the agent moves around, which is the expected behavior.

  • Press stop
  • Change “Agent Type” to “Robot”
  • Press play and click somewhere in the screen

Observe the agent does not move, but outputs warnings and errors to the Console window.

  • Press Stop
  • Open Window/Navigation and switch to the “Agents” tab
  • Compare the “Humanoid” and “Robot” agent types

Observe that their values are the same. Only the name is different.

Expected
Using custom “Agent Types” should not break the navigation system. Please also see the following feedback items I created, which are related to this:

Improve “SetDestination can only be called on an active agent that has been placed on a NavMesh.” error
https://feedback.unity3d.com/suggestions/improve-setdestination-can-only-be-called-on-an-active-agent-that-has-been-placed-on-a-navmesh-dot-error

Improve “Failed to create agent because it is not close enough to the NavMesh” warning
https://feedback.unity3d.com/suggestions/improve-failed-to-create-agent-because-it-is-not-close-enough-to-the-navmesh-warning

7 Likes

The bug-report has been added to the public Issue Tracker now:

2 Likes

Hi! Thank you for reporting this issue. The behaviour is actually the expected one. Every agent type needs its own separate NavMesh (in your example one for the Humanoid and one for the Robot). The warning message “Failed to create agent because it is not close enough to the NavMesh” wants to give a hint about the fact that there is no NavMesh available for one of the assigned agent types (Robot).
The NavMesh baked from within the Navigation window of the editor can only be used by the Humanoid agent. No other agent type can use it, including the Robot.
But multiple agent types can be used in Unity. In order to bake NavMeshes for other agent types you need to use the NavMeshSurface component, which can be downloaded from our official GitHub repository here GitHub - Unity-Technologies/NavMeshComponents: High Level API Components for Runtime NavMesh Building . Please read the manual section on this topic in order to get more information about how to set it up Unity - Manual: NavMesh building components .

6 Likes