Call function from a gdscript node in C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ComLarsic

I have a node with a gdscript, and one with a C# script.
In the gdscript one i have a function made that i need to call in the C# script.

Normally when i call a function in a different node i would go:

NodeClassName Node;

public override void _Ready()
    Node = GetNode<NodeClassName>("NodeName");

however in gdscript there are no classes (at least not like in C#)

how would i call a function in a gsdcript node?

ok , i figured it out.

just like Blazeowsky said, you can call a function using:

Node.Call("function", "parameters");

But i found out that if you want the return value you need to cast it like so:

string funcResult = (string)Node.Call("function", "parameters);

ComLarsic | 2020-04-28 11:23

:bust_in_silhouette: Reply From: Blazeowsky

Did you mean this?


i tried that, but it doesn’t seem to return the value, stating Cannot implicitly convert "object" to string

ComLarsic | 2020-04-25 14:58