|
@@ -30,6 +30,7 @@
|
|
|
|
|
|
#include "navigation_mesh_instance.h"
|
|
#include "navigation_mesh_instance.h"
|
|
|
|
|
|
|
|
+#include "core/os/os.h"
|
|
#include "core/os/thread.h"
|
|
#include "core/os/thread.h"
|
|
#include "mesh_instance.h"
|
|
#include "mesh_instance.h"
|
|
#include "navigation.h"
|
|
#include "navigation.h"
|
|
@@ -178,7 +179,12 @@ void NavigationMeshInstance::bake_navigation_mesh(bool p_on_thread) {
|
|
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
|
|
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
|
|
args->nav_region = this;
|
|
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);
|
|
bake_thread.start(_bake_navigation_mesh, args);
|
|
} else {
|
|
} else {
|
|
_bake_navigation_mesh(args);
|
|
_bake_navigation_mesh(args);
|