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) {
ERR_FAIL_COND_V(!valid, NULL);
if (!tool && !ScriptServer::is_scripting_enabled()) {
#ifdef TOOLS_ENABLED
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this));
@ -1971,12 +1969,14 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
// The project assembly is not loaded
ERR_EXPLAIN("Cannot instance script because the project assembly is not loaded. Script: " + get_path());
ERR_FAIL_V(NULL);
}
} else {
// 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_FAIL_V(NULL);
}
}
ERR_FAIL_COND_V(!valid, NULL);
if (native) {
String native_name = native->get_name();