void InitializeShipSpeedSelections() { for (int i = 0; i < System.Enum.GetValues(typeof(SpeedSetting)).Length; i++) { int a = i; _shipSpeedSettings.transform.GetChild(i) .GetComponent <Button>() .onClick .AddListener(() => CommandMapper.UpdateCurrentSpeed((SpeedSetting)a)); } }