diff options
author | smix8 <52464204+smix8@users.noreply.github.com> | 2022-05-14 18:25:45 +0200 |
---|---|---|
committer | smix8 <52464204+smix8@users.noreply.github.com> | 2022-05-16 00:55:15 +0200 |
commit | 49c603e1276b84f9b80414946429372f173bcbeb (patch) | |
tree | 01a6e50486fdab5e70649edf43dfd88bd4f1b45e /scene/3d | |
parent | 0841f72c380a285802f52f6f28240345c97a80d7 (diff) |
Disable threaded NavigationMesh bake on unsupported OS
Automatically disables threaded NavigationMesh bake when OS does not support threads.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 80be770dfc..6404432631 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -171,7 +171,12 @@ void NavigationRegion3D::bake_navigation_mesh(bool p_on_thread) { BakeThreadsArgs *args = memnew(BakeThreadsArgs); args->nav_region = this; - if (p_on_thread) { + if (p_on_thread && !OS::get_singleton()->can_use_threads()) { + WARN_PRINT("NavigationMesh bake 'on_thread' will be disabled as the current OS does not support multiple threads." + "\nAs a fallback the navigation mesh will bake on the main thread which can cause framerate issues."); + } + + if (p_on_thread && OS::get_singleton()->can_use_threads()) { bake_thread.start(_bake_navigation_mesh, args); } else { _bake_navigation_mesh(args); |