浏览代码

Merge pull request #56299 from raulsntos/fix-37812

Fix getting properties state when reloading C#
Ignacio Roldán Etcheverry 3 年之前
父节点
当前提交
be665ddff9
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      modules/mono/csharp_script.cpp

+ 10 - 1
modules/mono/csharp_script.cpp

@@ -1762,7 +1762,16 @@ void CSharpInstance::get_properties_state_for_reloading(List<Pair<StringName, Va
 
 		ManagedType managedType;
 
-		GDMonoField *field = script->script_class->get_field(state_pair.first);
+		GDMonoField *field = nullptr;
+		GDMonoClass *top = script->script_class;
+		while (top && top != script->native) {
+			field = top->get_field(state_pair.first);
+			if (field) {
+				break;
+			}
+
+			top = top->get_parent_class();
+		}
 		if (!field) {
 			continue; // Properties ignored. We get the property baking fields instead.
 		}