diff options
Diffstat (limited to 'scene/resources/packed_scene.cpp')
-rw-r--r-- | scene/resources/packed_scene.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index dcccc6898b..33334801c3 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -288,16 +288,18 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { // then tell this node to reference that resource. if (n.instance >= 0) { Ref<Resource> node_res = node->get(snames[nprops[j].name]); - node_res->copy_from(res); - node_res->configure_for_local_scene(node, resources_local_to_scene); - value = node_res; + if (node_res.is_valid()) { + node_res->copy_from(res); + node_res->configure_for_local_scene(node, resources_local_to_scene); + value = node_res; + } } else { HashMap<Ref<Resource>, Ref<Resource>>::Iterator E = resources_local_to_scene.find(res); Node *base = i == 0 ? node : ret_nodes[0]; if (E) { value = E->value; } else { - if (p_edit_state == GEN_EDIT_STATE_MAIN || p_edit_state == GEN_EDIT_STATE_MAIN_INHERITED) { + if (p_edit_state == GEN_EDIT_STATE_MAIN) { //for the main scene, use the resource as is res->configure_for_local_scene(base, resources_local_to_scene); resources_local_to_scene[res] = res; |