fix saving

This commit is contained in:
in0finite 2022-01-29 06:57:21 +01:00
parent c1cf249e8a
commit 6ecc9c11c0

View file

@ -135,10 +135,26 @@ namespace SanAndreasUnity.Editor
{
EditorUtility.DisplayProgressBar("", "Saving nav mesh...", 1f);
AssetDatabase.CreateAsset(m_navMeshData, saveFilePath);
}
try
{
if (AssetDatabase.Contains(m_navMeshData))
{
NavMesh.RemoveAllNavMeshData();
UnityEditor.AI.NavMeshBuilder.ClearAllNavMeshes();
m_navMeshDataInstance = new NavMeshDataInstance();
EditorUtility.ClearProgressBar();
m_navMeshData = Object.Instantiate(m_navMeshData);
m_navMeshDataInstance = NavMesh.AddNavMeshData(m_navMeshData);
}
AssetDatabase.CreateAsset(m_navMeshData, saveFilePath);
}
finally
{
EditorUtility.ClearProgressBar();
}
}
}
void Generate()