0 votes

I'm trying to use the GetConnectionList function in a project of mine, I saved the given array in an Array var called connList, till there all good but the problem comes when I want to use it, how do I convert it in a Connection Structure, so I can get the from node name?

in Engine by (12 points)

1 Answer

0 votes

I know this question is over a year old, but if you Google "Godot C# GetConnectionList" you end up here as one of the top results, so I wanted to share my solution for anyone who comes across.

I don't claim this is the best solution, or even the most correct, but it worked for me.

The following is how I get the fist from and to GraphNodes from the GraphEdit connection list:

var graph = GetNode<GraphEdit>("GraphEdit");
Array connectionList = graph.GetConnectionList;

var from = graph.GetNode<GraphNode>(
    ((Dictionary) connectionList[0])["from"].ToString()
);

var to = graph.GetNode<GraphNode>(
    ((Dictionary) connectionList[0])["to"].ToString()
);
by (14 points)
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.