When you take the time to understand it should be fairly clear…
This is how it is set up:
slot_1
slot_2
slot_3
slot_1
slot_2
slot_3
Which are all clickable buttons, so:
slot_1 // when we click this one it changes color
slot_2 // when we click this one the one above changes back, and this one changes color!
slot_3 // same thing
slot_1
slot_2
slot_3
However…
slot_1 // if we click this it changes color (which is same as before)
slot_2
slot_3
slot_1 // if we click this it changes color and the one above (1st category, 1st slot) does NOT change.
slot_2
slot_3
The problem ONLY occurs when we click the same slot in a different category, otherwise its fine.
Here is the code I wrote that makes all of it happen:
private void DisplaySlots(int X, int Y)
{
GUILayout.BeginArea(new Rect((Screen.width/1.5f)+45, (Screen.height)/2-30, 180, 500));
for (int i = X; i < Y; i++) // Display either 1-4 or 5-8 Categories
{
for (int j = 0; j < 5; j++) // Display five slots for each Category
{
if (GUILayout.Button(Spells[i][j], SpellSlot[i][j]))
{
for (int slot = 0; slot < 5; slot++)
{
if (slot == j)
{
SpellSlot[i][j].normal.textColor = Color.white;
}
else
{
for (int k = X; k < Y; k++)
{
SpellSlot[k][slot].normal.textColor = Color.black;
}
}
}
}
}
GUILayout.Space(15);
}
GUILayout.EndArea();
It would be so nice to get it fully functional! It is just one minor issue…