Disable threaded NavigationMesh bake on unsupported OS

Automatically disables threaded NavigationMesh bake when OS does not support threads.
This commit is contained in:
smix8
2022-05-14 18:25:45 +02:00
parent 0841f72c38
commit 49c603e127
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -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);