diff --git a/Source/Editor/CustomEditors/Dedicated/NavMeshBoundsVolumeEditor.cs b/Source/Editor/CustomEditors/Dedicated/NavMeshBoundsVolumeEditor.cs
new file mode 100644
index 000000000..2cbf01e41
--- /dev/null
+++ b/Source/Editor/CustomEditors/Dedicated/NavMeshBoundsVolumeEditor.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Wojciech Figat. All rights reserved.
+
+using FlaxEngine;
+
+namespace FlaxEditor.CustomEditors.Dedicated
+{
+ ///
+ /// Custom editor for .
+ ///
+ ///
+ [CustomEditor(typeof(NavMeshBoundsVolume)), DefaultEditor]
+ internal class NavMeshBoundsVolumeEditor : ActorEditor
+ {
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ base.Initialize(layout);
+
+ if (Values.HasDifferentTypes == false)
+ {
+ var button = layout.Button("Build");
+ button.Button.Clicked += OnBuildClicked;
+ }
+ }
+
+ private void OnBuildClicked()
+ {
+ foreach (var value in Values)
+ {
+ if (value is NavMeshBoundsVolume volume)
+ {
+ Navigation.BuildNavMesh(volume.Box, volume.Scene);
+ Editor.Instance.Scene.MarkSceneEdited(volume.Scene);
+ }
+ }
+ }
+ }
+}
diff --git a/Source/Editor/Editor.cs b/Source/Editor/Editor.cs
index 58466e35d..c881d9dcd 100644
--- a/Source/Editor/Editor.cs
+++ b/Source/Editor/Editor.cs
@@ -23,6 +23,7 @@ using FlaxEngine.Assertions;
using FlaxEngine.GUI;
using FlaxEngine.Interop;
using FlaxEngine.Json;
+using FlaxEngine.Utilities;
#pragma warning disable CS1591
@@ -1370,7 +1371,7 @@ namespace FlaxEditor
public void BuildCSG()
{
var scenes = Level.Scenes;
- scenes.ToList().ForEach(x => x.BuildCSG(0));
+ scenes.ForEach(x => x.BuildCSG(0));
Scene.MarkSceneEdited(scenes);
}
@@ -1380,7 +1381,7 @@ namespace FlaxEditor
public void BuildNavMesh()
{
var scenes = Level.Scenes;
- scenes.ToList().ForEach(x => Navigation.BuildNavMesh(x, 0));
+ Navigation.BuildNavMesh();
Scene.MarkSceneEdited(scenes);
}
diff --git a/Source/Engine/Navigation/NavMeshRuntime.cpp b/Source/Engine/Navigation/NavMeshRuntime.cpp
index 911700e19..0ace29415 100644
--- a/Source/Engine/Navigation/NavMeshRuntime.cpp
+++ b/Source/Engine/Navigation/NavMeshRuntime.cpp
@@ -5,6 +5,9 @@
#include "NavMesh.h"
#include "Engine/Core/Log.h"
#include "Engine/Core/Random.h"
+#if COMPILE_WITH_DEBUG_DRAW
+#include "Engine/Level/Scene/Scene.h"
+#endif
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Profiler/ProfilerMemory.h"
#include "Engine/Threading/Threading.h"
@@ -603,7 +606,21 @@ void NavMeshRuntime::DebugDraw()
if (!tile->header)
continue;
- //DebugDraw::DrawWireBox(*(BoundingBox*)&tile->header->bmin[0], Color::CadetBlue);
+#if 0
+ // Debug draw tile bounds and owner scene name
+ BoundingBox tileBounds = *(BoundingBox*)&tile->header->bmin[0];
+ DebugDraw::DrawWireBox(tileBounds, Color::CadetBlue);
+ // TODO: build map from tile coords to tile data to avoid this loop
+ for (const auto& e : _tiles)
+ {
+ if (e.X == tile->header->x && e.Y == tile->header->y && e.Layer == tile->header->layer)
+ {
+ if (e.NavMesh && e.NavMesh->GetScene())
+ DebugDraw::DrawText(e.NavMesh->GetScene()->GetName(), tileBounds.Minimum + tileBounds.GetSize() * Float3(0.5f, 0.8f, 0.5f), Color::CadetBlue);
+ break;
+ }
+ }
+#endif
for (int i = 0; i < tile->header->polyCount; i++)
{