Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2022.2 beta is now available for testing. To find out what's new, have a look at our 2022.2 feature highlights.
    Dismiss Notice
Dismiss Notice
Submit bug reports tagged with #Beta2022Win_Unity when you encounter unknown issues while testing the 2022.2 betas for a chance to win a year of Unity Pro. For more information, have a look at our Beta Sweepstakes Announcement.

(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,291
    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,291
    Deleted User and novicecode like this.
  3. adriant

    adriant

    Unity Technologies

    Joined:
    Nov 1, 2016
    Posts:
    52
    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 .
     
unityunity