- Home /
Specify background color of Gui.Button at runtime
How do you specify the background color of a GUI.Button - for making a limited button-click color palette, for example.
Amazed no one has answered this yet.. Is the only way to create color palette's to use a different color material each time?
Answer by ina · Dec 25, 2010 at 12:12 PM
This is not the most efficient answer - I am really hoping someone can give me a better one!:
1) instead of using guilayer and guibutton, use mesh colliders. raycast to figure out which one was "clicked"
2) material.color tint each one
--
the alternative would be to create several solid colors as different materials - does not seem that efficient, especially having to load different textures just for the color
1) use a new texture for each color, and a new guibutton each
There does not appear to be a background color field in GUIStyle - either that or I"m missing something..
Your answer
Follow this Question
Related Questions
Can I use hexidecimal colors in my GUI? 1 Answer
Changing the color of a GUI element 1 Answer
Change color of Gui.Box background to solid black 1 Answer
Disable Mouse Input when OnGUI() 1 Answer
Help with coloring a button? 1 Answer