From e61d547ed08924d75e18469fe648463dee3bd5a3 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 18 Aug 2017 08:25:04 -0300 Subject: Make sure local to scene resources are initialized after loading all nodes, fixes #9438 --- scene/resources/packed_scene.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scene/resources') diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 169c956546..4dfc23fa67 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -242,7 +242,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { value = local_dupe; } - res->setup_local_to_scene(); + //this here may reference nodes not iniialized so this line is commented and used after loading all nodes + //res->setup_local_to_scene(); } //must make a copy, because this res is local to scene } @@ -293,6 +294,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } } + for (Map, Ref >::Element *E = resources_local_to_scene.front(); E; E = E->next()) { + + E->get()->setup_local_to_scene(); + } + //do connections int cc = connections.size(); -- cgit v1.2.3