0 votes

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?

in Engine by (33 points)

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);

1 Answer

+1 vote
Best answer

Did you mean this?

by (51 points)
selected by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.