From 6c6c1302f388c1a0edfd685a3d7c079461bac79d Mon Sep 17 00:00:00 2001 From: VolTer Date: Tue, 28 Mar 2023 19:04:16 +0200 Subject: [PATCH] Fix PackedScenes created with PackedScene.pack() have their exported nodes become null --- scene/resources/packed_scene.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index a1e7558653b..1cb7c9e574f 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -263,17 +263,16 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { } } else { - if (Engine::get_singleton()->is_editor_hint()) { - // If editor, just set the metadata and be it. - node->set(PackedScene::META_POINTER_PROPERTY_BASE + String(prop_name), prop_variant); - continue; + node->set(PackedScene::META_POINTER_PROPERTY_BASE + String(prop_name), prop_variant); + + if (!Engine::get_singleton()->is_editor_hint()) { + // If not editor, do an actual deferred sed of the property path. + DeferredNodePathProperties dnp; + dnp.path = prop_variant; + dnp.base = node; + dnp.property = prop_name; + deferred_node_paths.push_back(dnp); } - // Do an actual deferred sed of the property path. - DeferredNodePathProperties dnp; - dnp.path = prop_variant; - dnp.base = node; - dnp.property = prop_name; - deferred_node_paths.push_back(dnp); } continue; }