when generating navmesh in Editor tool, add navmesh data before updating it

This commit is contained in:
in0finite 2022-02-21 04:33:04 +01:00
parent 2f6ee95a60
commit 396b0fd3a6

View file

@ -230,6 +230,11 @@ namespace SanAndreasUnity.Editor
cell.transform.rotation);
}
m_navMeshDataInstance = NavMesh.AddNavMeshData(m_navMeshData);
if (!Application.isPlaying)
EditorSceneManager.MarkSceneDirty(cell.gameObject.scene);
var asyncOperation = NavMeshBuilder.UpdateNavMeshDataAsync(
m_navMeshData,
navMeshBuildSettings,
@ -256,10 +261,6 @@ namespace SanAndreasUnity.Editor
yield break;
}
m_navMeshDataInstance = NavMesh.AddNavMeshData(m_navMeshData);
if (!Application.isPlaying)
EditorSceneManager.MarkSceneDirty(cell.gameObject.scene);
EditorUtility.ClearProgressBar();
EditorUtility.DisplayDialog("", "Nav mesh generation complete !", "Ok");
}