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. Dismiss Notice

Navigation/Navmesh - Failed to create agent because it is not close enough to the Navmesh

Discussion in 'Documentation' started by phxtr, Oct 21, 2017.

  1. phxtr

    phxtr

    Joined:
    Jul 8, 2017
    Posts:
    1
    I had a working project, and made some customization and all of a sudden started getting the above error.

    I lost nearly a whole day troubleshooting this issue, rebaking the navmesh, redoing the agent settings, adding debug code, reading pages and pages of unity docs, as well as google results, etc. etc. Only to find out the error was 'expected'.

    I finally got lucky and found the solution in this thread here:
    https://forum.unity.com/threads/cas...nt-type-causes-failed-to-create-agent.485847/

    The 'problem' was that I had added a new agent type. The procedure/interface was just like adding a new type for everything else (tags, layers, etc), so I never realized additional steps were required to make a new agent type work.

    Nothing in the documentation stated that the standard Navmesh is ONLY for the 'Humanoid' agent, and that adding a new type requires extra procedures.

    Could you modify the Navigation pages to mention this fact? Somewhere in the more general sections that people are more likely to see, and not buried somewhere preferably, 8^).

    Would possibly save a lot of people a lot of headache and lost time troubleshooting something that could be avoided with a quick mention in the documentation.
     
  2. trinistry

    trinistry

    Joined:
    Feb 2, 2014
    Posts:
    15
    The internet needs more heroes like you! Thank you for posting that here. There is no indication what so ever, why the agent would refuse to be on a NavMesh, when it is a custom agent type.
     
    Berillium and Frable like this.
  3. Frable

    Frable

    Joined:
    Nov 14, 2014
    Posts:
    1
    @phxtr Huge thank you from my side as well.
    Ran into the exact same issue and of course wasted lot of time to recheck various aspects.
    Never imagined that this might be the root cause for the problem.
    Changing to the default "humanoid" agent type made it work without a hitch.
     
    PharmacyBrain and Berillium like this.
  4. Meany747

    Meany747

    Joined:
    Jun 13, 2017
    Posts:
    9
    Massive thank you here as well, this is fairly poorly noted.
     
  5. GregoryFenn

    GregoryFenn

    Joined:
    Feb 13, 2018
    Posts:
    43
    I have the same problem and I'm using the only "Humaniod" agent :(
     
  6. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Thanks! Frustrating lack of warnings in the editor for this
     
  7. angelomoro

    angelomoro

    Joined:
    Sep 4, 2018
    Posts:
    13
    I've got the same issue on Unity 2019.2.9f1, so I was struggling to understand this for hours.

    Thank you so much!!! I deleted the other two Agent Types, and having only Humanoid, and then the component started to work again.

    Again, massive thanks, there should be a special warning in the component if the Agents are not setup as @God-at-play posted.
     
    PharmacyBrain likes this.
  8. JTSuda

    JTSuda

    Joined:
    Apr 25, 2021
    Posts:
    1
    Wow. Thank you. This fixed my problem
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,508
    This error also happens (at least in Unity 2018.4) when you re-enable an agent, but it's radius has been set to 0 via script. Increasing radius before enabling the agent fixes it.