Search Unity

NavMeshBuilder.BuildNavMesh() Build Error

Discussion in 'Navigation' started by Sayon, Apr 6, 2021.

  1. Sayon

    Sayon

    Joined:
    May 23, 2014
    Posts:
    13
    Hi, I'm currrently using the method NavMeshBuilder.BuildNavMesh() in one of my scripts to build a navmesh for a room at runtime. However, due to this being in the name space UnityEditor.AI I cannot build my game. As I get the error:

    Code (CSharp):
    1. The type or namespace name 'AI' does not exist in the namespace 'UnityEditor'
    After looking this up, as I understand it, I can't use the UnityEditor namespace in my game builds. So the question is, is there any method I can use to build a navmesh at runtime without using the UnityEditor namespace? I haven't been able to find any way to do it, so any help would be appreciated.

    Thanks in advance.

    EDIT: Okay, so I've found this: https://github.com/Unity-Technologies/NavMeshComponents after doing a little googling, and with it it looks as if I should be able to now bake my navmesh into my prefabs. However, it doesn't seem to work after importing the package. Does anyone know how I'm supposed to do this? I double click my prefab and click Bake in the navigation window, but nothing seems to happen.



    Okay I've gotten it working. I had to add the NavMeshSurface component to my room and then click bake on the component itself.
     
    Last edited: Apr 6, 2021
    felixwolny1 and LumbertVOLT like this.