Improve error message when instantiating virtual class

(cherry picked from commit 29dc8de88b)
This commit is contained in:
Maxime Lapointe 2021-10-05 08:09:09 -04:00 committed by Rémi Verschelde
parent 00d4a30b05
commit 487ca87e94
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -509,7 +509,7 @@ Object *ClassDB::instance(const StringName &p_class) {
}
ERR_FAIL_COND_V_MSG(!ti, nullptr, "Cannot get class '" + String(p_class) + "'.");
ERR_FAIL_COND_V_MSG(ti->disabled, nullptr, "Class '" + String(p_class) + "' is disabled.");
ERR_FAIL_COND_V(!ti->creation_func, nullptr);
ERR_FAIL_COND_V_MSG(!ti->creation_func, nullptr, "Class '" + String(p_class) + "' or its base class cannot be instantiated.");
}
#ifdef TOOLS_ENABLED
if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {