소스 검색

Fix export var override in PackedScene at runtime

Regression fix: update_exports is tool only and should be used only in
the editor, otherwise it can cause export variable overrides from
instances to be discarded in favor of the parent's value.

(cherry picked from commit f1587c8a7dcb6e28ee6659b83b02a4c6d3bd4073)
PouleyKetchoupp 4 년 전
부모
커밋
7a8020ea67
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      scene/resources/packed_scene.cpp

+ 3 - 1
scene/resources/packed_scene.cpp

@@ -483,7 +483,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
 	StringName type = p_node->get_class();
 
 	Ref<Script> script = p_node->get_script();
-	if (script.is_valid()) {
+	if (Engine::get_singleton()->is_editor_hint() && script.is_valid()) {
+		// Should be called in the editor only and not at runtime,
+		// otherwise it can cause problems because of missing instance state support.
 		script->update_exports();
 	}