public override void _Ready() { AddChild(_controlGroupTimer); _controlGroupTimer.Connect("timeout", this, nameof(OnGroupTimerComplete)); ButtonList = new BaseButton[GameData.controlGroups.Length]; for (var i = 0; i < ButtonList.Length; i++) { ButtonList[i] = new Button { Text = i.ToString(), Visible = false }; AddChild(ButtonList[i]); var indexArr = new Array(new[] { i }); ButtonList[i].Connect("pressed", this, nameof(ControlGroupButtonPressed), indexArr); ButtonList[i].Connect("gui_input", this, nameof(ControlGroupGuiInput), indexArr); GameData.AddControlGroupChangeEvent(i, (g, num) => ButtonList[num].Visible = g != null); } ButtonList[0].MoveInParent(-1); MoveChild(ButtonList[0], GetChildCount()); }