Browse Source

Optimize ClassDB::get_direct_inheriters_from_class.

Co-authored-by: kleonc <[email protected]>
Yufeng Ying 5 months ago
parent
commit
c37c92b450
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/object/class_db.cpp

+ 1 - 1
core/object/class_db.cpp

@@ -298,7 +298,7 @@ void ClassDB::get_direct_inheriters_from_class(const StringName &p_class, List<S
 	OBJTYPE_RLOCK;
 	OBJTYPE_RLOCK;
 
 
 	for (const KeyValue<StringName, ClassInfo> &E : classes) {
 	for (const KeyValue<StringName, ClassInfo> &E : classes) {
-		if (E.key != p_class && _get_parent_class(E.key) == p_class) {
+		if (E.value.inherits == p_class) {
 			p_classes->push_back(E.key);
 			p_classes->push_back(E.key);
 		}
 		}
 	}
 	}