Skip to content

Fix marshalling when a function is returning an object from c#

Here's the situation now: if you setup those two nodes in a project, the behavior is inconsistent.

public class Foo : Node
{
    public object[] GetVar() { return new object[] { "foo"; } }
    public object GetVar2() { return "foo"; }
}
extends Node

export (NodePath) var fooPath
onready var foo = get_node(fooPath)

func _ready():
    print(foo.call("GetVar"))
    print(foo.call("GetVar2"))

It prints:

[foo]
Null

And raise a marshalling error when calling GetVar2.

To fix this, I removed the hint we're getting from the function return type. I'm not sure we should always do this or only when the return type is actually object.

Merge request reports