Mention expected resource type in ResourceLoader load error

This helps troubleshoot issues due to incorrect import types.
This commit is contained in:
Hugo Locurcio 2023-07-21 04:45:34 +02:00
parent f8dbed4d0a
commit 5bf64255b0
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C

View File

@ -275,10 +275,10 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
#ifdef TOOLS_ENABLED
Ref<FileAccess> file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES);
ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), Ref<Resource>(), "Resource file not found: " + p_path + ".");
ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), Ref<Resource>(), vformat("Resource file not found: %s (expected type: %s)", p_path, p_type_hint));
#endif
ERR_FAIL_V_MSG(Ref<Resource>(), "No loader found for resource: " + p_path + ".");
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("No loader found for resource: %s (expected type: %s)", p_path, p_type_hint));
}
void ResourceLoader::_thread_load_function(void *p_userdata) {