IEnumerator BakeNavMesh() { var data = InitializeBakeData(); var async = navMeshSurface.UpdateNavMesh(data); while (!async.isDone) { print("loading"); yield return(null); } print("finished"); navMeshSurface.navMeshData = data; navMeshSurface.AddData(); }
// Update is called once per frame void Update() { surface.UpdateNavMesh(surface.navMeshData); }