mirror of
https://github.com/godotengine/godot.git
synced 2025-01-30 13:51:29 +00:00
Merge pull request #25890 from neikeq/issue-25818
Fix Godot.Reference marshalling from MonoObject* to Variant
This commit is contained in:
commit
1174d10e3c
@ -698,7 +698,11 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
|
|||||||
// GodotObject
|
// GodotObject
|
||||||
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
|
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
|
||||||
Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
|
Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
|
||||||
return ptr ? Variant(ptr) : Variant();
|
if (ptr != NULL) {
|
||||||
|
Reference *ref = Object::cast_to<Reference>(ptr);
|
||||||
|
return ref ? Variant(Ref<Reference>(ref)) : Variant(ptr);
|
||||||
|
}
|
||||||
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CACHED_CLASS(NodePath) == type_class) {
|
if (CACHED_CLASS(NodePath) == type_class) {
|
||||||
|
Loading…
Reference in New Issue
Block a user