diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 94a031947abc..976210668ff1 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -314,6 +314,17 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { ERR_FAIL_INDEX_V(nprops[j].value, prop_count, nullptr); if (nprops[j].name & FLAG_PATH_PROPERTY_IS_NODE) { + if (node->get_scene_instance_load_placeholder()) { + // nodes might not exist yet, so we skip deffering nodepath resolution to placeholder instantiation + // this does not solve arrays problems, and creates issues with external node referneces + + uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1); + ERR_FAIL_UNSIGNED_INDEX_V(name_idx, (uint32_t)sname_count, nullptr); + + node->set(snames[name_idx], props[nprops[j].value], &valid); + continue; + } + uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1); ERR_FAIL_UNSIGNED_INDEX_V(name_idx, (uint32_t)sname_count, nullptr); @@ -358,7 +369,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { value = setup_resources_in_array(set_array, n, resources_local_to_sub_scene, node, snames[nprops[j].name], resources_local_to_scene, i, ret_nodes, p_edit_state); bool is_get_valid = false; - Variant get_value = node->get(snames[nprops[j].name], &is_get_valid); + Variant get_value = node->get(snames[nprops[j].name], &is_get_valid); // this will always be false for InstancePlaceholders because set has not been called, resulting in un-typed arrays if (is_get_valid && get_value.get_type() == Variant::ARRAY) { Array get_array = get_value;