From b9225f67c85c3eab47df96b9fa1bd5a5034eae53 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:21:02 +0200 Subject: [PATCH] Warn that navigation mesh baking from Meshes is bad for runtime performance Warns that navigation mesh baking from Meshes is bad for runtime performance. --- .../3d/navigation_mesh_source_geometry_data_3d.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp index 39a17946fa8f..b57f7bb01d43 100644 --- a/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp +++ b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp @@ -158,6 +158,15 @@ void NavigationMeshSourceGeometryData3D::_add_faces(const PackedVector3Array &p_ void NavigationMeshSourceGeometryData3D::add_mesh(const Ref &p_mesh, const Transform3D &p_xform) { ERR_FAIL_COND(!p_mesh.is_valid()); + +#ifdef DEBUG_ENABLED + if (!Engine::get_singleton()->is_editor_hint()) { + WARN_PRINT_ONCE("Source geometry parsing for navigation mesh baking had to parse RenderingServer meshes at runtime.\n\ + This poses a significant performance issues as visual meshes store geometry data on the GPU and transferring this data back to the CPU blocks the rendering.\n\ + For runtime (re)baking navigation meshes use and parse collision shapes as source geometry or create geometry data procedurally in scripts."); + } +#endif + _add_mesh(p_mesh, root_node_transform * p_xform); }