Ver Fonte

Implement CSharpScript::inherits_script()

(cherry picked from commit 840255a04b2248dbe537e507c1ceb7ac90713270)
Ignacio Etcheverry há 5 anos atrás
pai
commit
417a69c643
1 ficheiros alterados com 9 adições e 2 exclusões
  1. 9 2
      modules/mono/csharp_script.cpp

+ 9 - 2
modules/mono/csharp_script.cpp

@@ -3211,8 +3211,15 @@ bool CSharpScript::inherits_script(const Ref<Script> &p_script) const {
 		return false;
 	}
 
-	WARN_PRINT_ONCE("Implement CSharpScript::inherits_script and other relevant changes after GH-38063.");
-	return false;
+	if (script_class == nullptr || cs->script_class == nullptr) {
+		return false;
+	}
+
+	if (script_class == cs->script_class) {
+		return true;
+	}
+
+	return cs->script_class->is_assignable_from(script_class);
 }
 
 Ref<Script> CSharpScript::get_base_script() const {