Browse Source

Fix can not set process priority of node if not any process is processing

(cherry picked from commit e36117f557326d32f1da65394432596304e3d44e)
jsjtxietian 1 year ago
parent
commit
2d82ab735c
1 changed files with 10 additions and 2 deletions
  1. 10 2
      scene/main/node.cpp

+ 10 - 2
scene/main/node.cpp

@@ -967,7 +967,11 @@ void Node::set_process_priority(int p_priority) {
 
 	if (_is_any_processing()) {
 		_remove_from_process_thread_group();
-		data.process_priority = p_priority;
+	}
+
+	data.process_priority = p_priority;
+
+	if (_is_any_processing()) {
 		_add_to_process_thread_group();
 	}
 }
@@ -989,7 +993,11 @@ void Node::set_physics_process_priority(int p_priority) {
 
 	if (_is_any_processing()) {
 		_remove_from_process_thread_group();
-		data.physics_process_priority = p_priority;
+	}
+
+	data.physics_process_priority = p_priority;
+
+	if (_is_any_processing()) {
 		_add_to_process_thread_group();
 	}
 }