I am going through the buttons using a for each loop, and they should attach a signal on build.
I have some buttons that should be clickable on build, but it doesn't seem to be working. I get no errors, the buttons don't respond at all.
Anything I'm missing? Maybe it's how I write the array? (The "MenuButton" is just how I get access to the "scenetoload" String variable, it should be of the Button type.
foreach (MenuButton button in GetNode("Menu/CenterRow/Buttons").GetChildren())
{
button.Connect("pressed", this, nameof(OnButtonPressed), new Godot.Collections.Array() { button.scene_to_load });
Where I'm getting the "MenuButton" from to access the scenetoload variable.
public class MenuButton : Button
{
[Export]
public String scene_to_load;
}
Then it should excute this method (The scenetoload variable should load & open the corresponding scene the buttons are linked to, but don't seem to respond.)
void OnButtonPressed(String scene_to_load)
{
GetTree().ChangeScene(scene_to_load);
//scene_path_to_load = scene_to_load;
}
Thank you very much for your help! Addtional info, can be provided if needed, thanks.