1 Problem with Inventory!

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()
	{	
		GUILayout.BeginArea(new Rect((Screen.width/1.5f)+45, (Screen.height)/2-30, 180, 500));
		
		for (int i = 0; i < 2; i++) // Display Categories
		{
				for (int j = 0; j < 3; j++) // Display slots
				{
					if (GUILayout.Button("Slots", StyleArray[i][j]))
					{
						for (int slot = 0; slot < 3; slot++)
						{
							if (slot == j)
							{
								StyleArray[i][j].normal.textColor = Color.white;
							}
							else
							{
								for (int k = 0; k < 3; k++)
								{
									StyleArray[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…

Well i don’t expect anyone to reply with such a horrible code block

wow i think you first take some lessons scripting because i cant find my way in that !
if you clean it maybe we can help

nalim, he posted 3 duplicate topics and it’s currently being discussed and was resolved here:
http://forum.unity3d.com/threads/65253-1-Problem-with-Inventory!