summaryrefslogtreecommitdiff
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <neikeq@users.noreply.github.com>2021-12-29 00:14:23 +0100
committerGitHub <noreply@github.com>2021-12-29 00:14:23 +0100
commitbe665ddff9662cf32d1f8651d4951324879dd8b2 (patch)
tree381fb2d7080178097ae8b69c2a4b6b37227cc733 /modules/mono/csharp_script.cpp
parent28174d531b7128f0281fc2b88da2f4962fd3513e (diff)
parent5254b28632a3ea212ae69c86cc737768f26b9e12 (diff)
Merge pull request #56299 from raulsntos/fix-37812
Fix getting properties state when reloading C#
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 0ceb45d425..aa24f59fdb 100644
--- a/modules/mono/csharp_script.cpp
+++ b/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.
}