Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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

Discussion in '2017.2 Beta' started by Peter77, Jul 30, 2017.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    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/sugges...t-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/sugges...it-is-not-close-enough-to-the-navmesh-warning
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    Deleted User and novicecode like this.
  3. adriant

    adriant

    Unity Technologies

    Joined:
    Nov 1, 2016
    Posts:
    69
    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 https://github.com/Unity-Technologies/NavMeshComponents . Please read the manual section on this topic in order to get more information about how to set it up https://docs.unity3d.com/2017.2/Documentation/Manual/NavMesh-BuildingComponents.html .