diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-18 10:38:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 10:38:41 +0200 |
commit | 76d90bb568736eac419d94ed32a4de820e9469ab (patch) | |
tree | 46223073c29233e54ce71ae89418a13e941b484b /modules | |
parent | 523e0d80a8118c933dc2fb747874526cd72e1f92 (diff) | |
parent | bc47bacc9efc92c08c6b512ec10ac013a4aaed4b (diff) |
Merge pull request #53943 from raulsntos/fixup-53581
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index f8736dd043..1904634132 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -1256,6 +1256,17 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type GDMonoUtils::Marshal::array_get_element_type(reftype, &elem_reftype); return system_generic_list_to_Array_variant(p_obj, p_type.type_class, elem_reftype); } + + // GodotObject + GDMonoClass *type_class = p_type.type_class; + if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { + Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj)); + if (ptr != nullptr) { + RefCounted *rc = Object::cast_to<RefCounted>(ptr); + return rc ? Variant(Ref<RefCounted>(rc)) : Variant(ptr); + } + return Variant(); + } } break; } |