Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug No Valid NavMesh in Executable

Discussion in 'Navigation' started by rg18, Oct 2, 2020.

  1. rg18

    rg18

    Joined:
    Aug 29, 2020
    Posts:
    14
    I'm making a top-down 3d game with a simple NavMesh. The game runs correctly within the editor but not after building to an executable. I get the following error for each of my agents:

    "Failed to create agent because there is no valid NavMesh
    (Filename: C:\buildslave\unity\build\Modules/AI/Components/NavMeshAgent.cpp Line: 634)"


    Interestingly though, the agents still move correctly.

    Here's a picture of the components for each of the agents: Capture.PNG

    Here's a picture of the NavMesh Surface component I'm using. navmesh.PNG

    Note: I'm using this in conjunction with ML-Agents.
     
    kaan0550 and cloud1011 like this.
  2. cloud1011

    cloud1011

    Joined:
    May 21, 2018
    Posts:
    3
    I'm also getting these errors. It appears that the navmesh surfaces are somehow unavailable when the first attempt to create the navmesh agents occurs. Why is this happening in the built exe but not in the editor? For more information, all of our nav mesh data and agents are attached to game objects and baked prior to runtime. Nothing is instantiated at runtime via our code.

    As OP said, the nav agents are eventually created and behave normally, but it is unfortunate to have thousands of lines of noise due to a race condition. This impacts scene loading performance.
     
    Last edited: Apr 5, 2021
    kaan0550 likes this.
  3. cloud1011

    cloud1011

    Joined:
    May 21, 2018
    Posts:
    3
    Is there a simple way to ensure the NavMesh Surfaces are properly initialized prior to Unity attempting to create all the agents?
     
    kaan0550 likes this.
  4. kaan0550

    kaan0550

    Joined:
    Jun 2, 2019
    Posts:
    10
    I have same problem on 2022.3.3f1. On player.log I can see "Failed to create agent because there is no valid NavMesh" after loading the scene.

    Usually those errors which editor does not show but in game shows, they are related to start functions. If you gave a referance in start and calling it in another start function that might be okay because slow loading in unity editor, but game loads faster and create problems.

    Currently, I am trying to find problem. You need to check your codes too.

    Any help from the community would be appreciated.