From 326314eaa970a9025dd0372e2a519f7933842bfa Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 19 Nov 2023 13:12:55 +0100 Subject: [PATCH] Provide more context when scene fails to load (cherry picked from commit c6c872ba344a72f5e962f8c10f8c33cbfd311044) --- scene/resources/packed_scene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 359c4765a2e..9dcb7cecae4 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -89,7 +89,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { } int nc = nodes.size(); - ERR_FAIL_COND_V(nc == 0, nullptr); + ERR_FAIL_COND_V_MSG(nc == 0, nullptr, vformat("Failed to instantiate scene state of \"%s\", node count is 0. Make sure the PackedScene resource is valid.", path)); const StringName *snames = nullptr; int sname_count = names.size(); @@ -170,7 +170,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { Ref sdata = props[n.instance & FLAG_MASK]; ERR_FAIL_COND_V(!sdata.is_valid(), nullptr); node = sdata->instantiate(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); - ERR_FAIL_NULL_V(node, nullptr); + ERR_FAIL_NULL_V_MSG(node, nullptr, vformat("Failed to load scene dependency: \"%s\". Make sure the required scene is valid.", sdata->get_path())); } } else if (n.type == TYPE_INSTANTIATED) {