When a button is pressed, it calls OnComboButtonPressed
and gives it some argument called arg0
(you can change the arg0
bit to something more meaningful, though, like selectEnterArg
).
The explanation is in the code
private void OnComboButtonPressed(SelectEnterEventArgs arg0)
{
// Loop through each button
for (int i = 0; i < comboButtons.Length; i++)
{
// check if the button we pressed is the button we are currently looping over
if (arg0.interactableObject.transform.name == comboButtons[i].transform.name)
{
// if it is, set userInputText equal to the index of the button
userInputText.text = i.ToString();
}
else
{
// if it's not, reset the button we are currently looping over's color
comboButtons[i].ResetColor();
}
}
}