Search Unity

Failed to create agent because there is no valid NavMesh ONLY on mobile device

Discussion in 'Navigation' started by mistergreen2016, Jun 19, 2019.

  1. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    123
    Hey I'm having a weird issue I can't figure out. Things work fine from the Unity IDE but when I run the game from a device like an iPad, I get this error.

    Code (CSharp):
    1. Failed to create agent because there is no valid NavMesh
    And the agent are placed off the required Navmesh. It does get placed on a near by navmesh which I don't want.

    I'm using the Navmesh surface script to bake the terrain. I wonder if there's a timing issue where the navmesh haven't finished loading or something. I tried using LoadSceneAsync instead but got the same error.

    Any ideas?
     
  2. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    123
    I found a hack where I agent.enabled = false on Start() or Awake(). Then turn it back on right after Start().
     
  3. Smashedleek

    Smashedleek

    Joined:
    Sep 5, 2019
    Posts:
    1
    Im currently having the same issue no matter how many times i reset the player and cube its connected to its not a valid navmesh
     
  4. rgrlee71

    rgrlee71

    Joined:
    Sep 11, 2012
    Posts:
    31
    This has long been a problem in Unity and it just pops up randomly. The only way I could solve it was to create the Navmesh Agent component after the game was started and plug in the variable values at run time.