From 3b80eb06b744c8a374970cd87819f98a81d8b9ba Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Thu, 5 Dec 2019 01:18:48 +0100 Subject: [PATCH] Don't store index of root nodes --- scene/resources/packed_scene.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7d62873bbdb..5ce269fff91 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -397,6 +397,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map if (p_owner->get_scene_inherited_state().is_null() && (p_node == p_owner || (p_node->get_owner() == p_owner && (p_node->get_parent() == p_owner || p_node->get_parent()->get_owner() == p_owner)))) { //do not save index, because it belongs to saved scene and scene is not inherited nd.index = -1; + } else if (p_node == p_owner) { + //This (hopefully) happens if the node is a scene root, so its index is irrelevant. + nd.index = -1; } else { //part of an inherited scene, or parent is from an instanced scene nd.index = p_node->get_index();