GDScript Line Translation into C# help?

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

Hi again ! :slight_smile:
(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!

:bust_in_silhouette: Reply From: davidoc

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.

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

AlMoeSharpton86 | 2019-06-06 23:49