Hello,
I'm having issues with my UI-Setup. I'm pretty new to Unity and NGUI so expect some noob-mistakes and try to answer in easy words

I wanna have a build menu with blue buttons and the one selected should be orange. If i start the game, the buttons don't get colored or depending what i set as structureIndex, don't get drawn at all.
My Setup is like this:
I set up two buttons for testing. The Sprites linked to the buttons are set to "Sprite Type: Sliced" and "Fill Center: checked" by default in the Inspector. I colored them both in white, cause i wanna set the color through my build-menue script.
The Script ( i just posted the parts concerning the UI issue):
public Color onColor;
public Color offColor;
public UISprite[] buildBtnGraphics;
public int structureIndex;
void Start ()
{
structureIndex = 1;
UpdateGUI ();
}
public void UpdateGUI ()
{
for (int i=0; i==buildBtnGraphics.Length; i++)
{
buildBtnGraphics
.color = offColor;
}
buildBtnGraphics [structureIndex].color = onColor;
}
So the variable buildBtnGraphics is giving me an Array in the Inspector, where i can drag´n´drop the sprites in. I tired to use UISlicedSprite[] here, but then i couldn´t drag´n´drop anything in. This is the first thing i can´t get my head around. Why can´t i use UISlicedSprite[] here, if "Sprite Type" is set to sliced. I also tried to set the "Sprite Type" to "simple", but it didn't change anything.
So whenever the player clicks a button, the structureIndex is set to whatever is clicked and the UpdateGUI function is called. The UpdateGUI function should draw every element in the UISprite-Array to the offColor and the one selected (structureIndex) to the onColor.
Funny fact: Both Buttonsprites seem to get treated differently. If i set structureIndex to 0 (first sprite), everything is drawn in white and in the inspector of the sprite (during runtime) no orange is applied. When i set it to 1 (second Buttonsprite), the button is not drawn at all, but in the inspector i see, that the orange color is applied to the button.
So it seems that the hole problem is down to the Sprite-Types (sliced or not?) and how to set them up properly, but i can't figure it out