- Home /
Question by
Malwallace12 · Jun 19, 2015 at 06:22 PM ·
buttoncolortexture2dguilayout
Hair and Skin Color Buttons
I am trying to create colored squares for players to pick hair and skin color from using GUI.Layout. So far my code looks like this.
GUILayout.BeginHorizontal();
GUILayout.Label ("Hair Color");
foreach(Color hairColor in HairColorPalette){
Color[] buttonColor = new Color[2500];
int x = 0;
if(x < 2500){
buttonColor[x]= hairColor;
x += 1;
}
Texture2D buttonTex = new Texture2D(50, 50);
buttonTex.SetPixels(buttonColor);
if(GUILayout.Button(buttonTex)){
return;
}
The buttons show up but they remain colorless. I'm not sure what I am doing wrong. Any ideas?
Comment