Topic was automatically imported from the old Question2Answer platform.
Asked By
ondesic
I am migrating C# code to Godot 4.
Here is a line of Godot 3.5 code:
myButton.Connect("button_down", this, "_btnDown", new Godot.Collections.Array{24});
This code connects the button_down signal to the _btnDown(int num) function. It will also send the number 24 to the _btnDown(int num) function everytime the “myButton” is pressed.
Looks like that will send an array with a single element 24.
In any case this is (option 3 from the docs on connect) using GDScript. It should be very similar in c# and ignoring the array aspect:
myButton.button_down.connect(_btnDown.bind(24))
You should be able to work it into c#. I think bind is the aspect you were missing.
It is possible that bind is not yet implemented in C# version. Here is some workarounds
Uhg.
I tried this binding and it just doesn’t work. I think you are right. It may not need implemented in C# yet. That is really unfortunate.
I don’t want to mess with the workaround because I’ll just have to change the code again once binding is implemented.
Sadly, i feel like i just have to wait to migrate my project. It relies heavily on binding built in signals.