Fix '!valid' error spam on C# script instance create

(cherry picked from commit 8edf85b09c)
This commit is contained in:
Ignacio Etcheverry 2018-07-25 21:30:43 +02:00 committed by Hein-Pieter van Braam
parent cf1c127c23
commit 286ff21dd1
1 changed files with 6 additions and 6 deletions

View File

@ -1953,8 +1953,6 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::Call
ScriptInstance *CSharpScript::instance_create(Object *p_this) { ScriptInstance *CSharpScript::instance_create(Object *p_this) {
ERR_FAIL_COND_V(!valid, NULL);
if (!tool && !ScriptServer::is_scripting_enabled()) { if (!tool && !ScriptServer::is_scripting_enabled()) {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this)); PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this));
@ -1971,13 +1969,15 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
// The project assembly is not loaded // The project assembly is not loaded
ERR_EXPLAIN("Cannot instance script because the project assembly is not loaded. Script: " + get_path()); ERR_EXPLAIN("Cannot instance script because the project assembly is not loaded. Script: " + get_path());
ERR_FAIL_V(NULL); ERR_FAIL_V(NULL);
} } else {
// The project assembly is loaded, but the class could not found // The project assembly is loaded, but the class could not found
ERR_EXPLAIN("Cannot instance script because the class '" + name + "' could not be found. Script: " + get_path()); ERR_EXPLAIN("Cannot instance script because the class '" + name + "' could not be found. Script: " + get_path());
ERR_FAIL_V(NULL); ERR_FAIL_V(NULL);
}
} }
ERR_FAIL_COND_V(!valid, NULL);
if (native) { if (native) {
String native_name = native->get_name(); String native_name = native->get_name();
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) { if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {