Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

13

Found in

2017.2.0b4

Issue ID

936460

Regression

No

Custom NavMesh Agent Type causes an error "Failed to create agent" in the Console

AI Navigation

-

Reproduction steps:
1. Open the attached project "BugReport_NavMesh_FailedToCreateAgent.zip";
2. Open Scene.unity;
3. Select "My Agent" in Hierarchy and notice its "Agent Type" is "Humanoid";
4. Bake the navmesh and enter a play mode;
5. Click somewhere on the screen - observe the agent moves around;
6. Stop the play mode and change "Agent Type" to "Robot";
7. Press play and click somewhere on the screen.

Actual results: The agent does not move but outputs an to the Console window:
"Failed to create agent because it is not close enough to the NavMesh"

Expected results: Custom Navmesh Agent Type should be working as well as the default.

Reproduced on: 5.6.2p4, 2017.1.0p2, 2017.2.0b5, 2017.3.0a2.

  1. Resolution Note:

    Will be fixed as part of work planned for improving Navigation workflow.

    Please note that 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.
    You can use the NavMeshSurface component from the com.unity.ai.navigation experimental package in order to bake a NavMesh for custom agent types. Please see this manual page https://docs.unity3d.com/Packages/com.unity.ai.navigation@1.0/manual/index.html .

Comments (7)

  1. TheGameLearner

    May 08, 2022 12:48

    This is pain Stupid, either allow us to bake multiple agents or allow us to only have humanoid before we install packages to create more.
    Do not create errors just to make people search new Packages

  2. firecat91

    Apr 11, 2020 12:49

    I know this is long after this issue, but I actually downloaded these components, followed the directions to add it to my project, but it doesn't work. It just comes up with a bunch of errors because some functions don't seem to exist.

    These are:
    [Execute Always]
    EditorSceneManager.IsPreviewSceneObject
    StageUtility
    UnityEditor.AI.NavMeshBuilder.CollectSourcesInStage

    I tried to look up solutions to this, but all of them point back here.

  3. LoekvanKooten

    Dec 24, 2018 13:30

    Sorry, but this design is plain stupid. If you give us the possibility to use different agents, then please also support them in the default Unity version, not by sending us to GitHub and have us compilie software ourselves. This is Windows, not Linux. So please, provide a way to bake new NavMeshes for different agents - from Unity's own interface.

  4. Epok

    Dec 01, 2018 19:03

    If this is intended, then why not have NavMeshSurface in the official build? Why is it Github and why did I spend 24 hours researching this? You release updates so often that a lot of the official tutorials I see online are confusing since the UI is out of date. Movement AI is a very crucial part of most games too.

  5. phobos2077

    Jun 08, 2018 11:51

    I have stumbled upon this today and spent a good chunk of my day trying to find what's causing the issue. IMO, you should revamp the navigation system to make it more clear. Sending the user to download some code from github is strange, either make all related components built in (including NavMeshSurface) or remove the Bake functionality from UI completely and make it be controlled manually from code. This way it will be less confusing.

  6. vandijkstef

    Nov 18, 2017 10:44

    Maybe remove agent types unless you have that extra component?
    Or notify us when we create a new agent?

  7. adriant

    Aug 01, 2017 17:45

    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 .

    We will resolve this issue by providing improved warning messages for similar situations.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.