Response Menu Panel Buttons with different colors
Posted: Fri Sep 30, 2022 11:22 am
Hi Tony.
Like ShuffleResponsesScript, I would like to assign different colors to my buttons.
All my Dialogues have 4 Responses. So I would like to assign 4 different colors to each one, but knowing what color I'm assigning to each answer.
What i'm doing is:
buttons = new GameObject[4];
colors = new List<Color> { Color.red, Color.blue, Color.yellow, Color.green };
ShuffleListScript.Shuffle(colors);
I asign the Tag DialogueButton to my Response Button Template
buttons = GameObject.FindGameObjectsWithTag("DialogueButton");
buttons[0].GetComponent<Image>().color = colors[0];
buttons[1].GetComponent<Image>().color = colors[1];
buttons[2].GetComponent<Image>().color = colors[2];
buttons[3].GetComponent<Image>().color = colors[3];
But, in some cases I get this error:
Index out of bounds
Is there a better way to do this like ShuffleResponsesScript ?
Like ShuffleResponsesScript, I would like to assign different colors to my buttons.
All my Dialogues have 4 Responses. So I would like to assign 4 different colors to each one, but knowing what color I'm assigning to each answer.
What i'm doing is:
buttons = new GameObject[4];
colors = new List<Color> { Color.red, Color.blue, Color.yellow, Color.green };
ShuffleListScript.Shuffle(colors);
I asign the Tag DialogueButton to my Response Button Template
buttons = GameObject.FindGameObjectsWithTag("DialogueButton");
buttons[0].GetComponent<Image>().color = colors[0];
buttons[1].GetComponent<Image>().color = colors[1];
buttons[2].GetComponent<Image>().color = colors[2];
buttons[3].GetComponent<Image>().color = colors[3];
But, in some cases I get this error:
Index out of bounds
Is there a better way to do this like ShuffleResponsesScript ?