void TimeButtonPressed(GameObject go) { //Convert the name to an int to then cast to the enum. sessionCreator.StartNewGame(Convert.ToInt32(go.name)); SwitchState(MenuState.Off); }