0 votes

Hi again ! :)
(Apologies)

Currently following the same tutorial - https://www.youtube.com/watch?v=sKuM5AzK-uA

I can't seem to work out the syntax (code is GDScript) to write it into C#
As arrays have diffrent syntax in C# then GDScript

What would be the equivalent/translation of this line in C# from GDScript?

 button.connect("pressed", self, "_on_Button_pressed", [button.scene_to_load])

Thank you again!

in Engine by (53 points)

1 Answer

0 votes
Best answer

You could use something like this:

button.Connect("pressed", this, nameof(OnButtonPressed), new Godot.Collections.Array() { button.scene_to_load });

Are you using Godot's editor? If yes I'd recommend you to switch to Visual Studio or VS Code, the intellisense will give you the required info you need.

by (978 points)
selected by

Thank you! Very helpful and thankful, and I am :)

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.