summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2021-06-18 10:54:09 -0700
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2021-06-18 10:54:09 -0700
commitf1587c8a7dcb6e28ee6659b83b02a4c6d3bd4073 (patch)
tree89755093c8c1599009b6692039568975f6b6ede9 /scene/resources
parent92f20fd70e6957cd65ccb7837fdc28f9b1e4a315 (diff)
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.
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/packed_scene.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index ab8a4b7934..9f04ff80e1 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -471,7 +471,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();
}