x


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.

more ▼

asked Dec 24 '10 at 11:51 AM

ina gravatar image

ina
3.3k 492 547 597

Amazed no one has answered this yet.. Is the only way to create color palette's to use a different color material each time?

Dec 25 '10 at 12:07 PM ina
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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

more ▼

answered Dec 25 '10 at 12:12 PM

ina gravatar image

ina
3.3k 492 547 597

Have you looked at GUIStyle?

Dec 26 '10 at 11:45 AM _Petroz

There does not appear to be a background color field in GUIStyle - either that or I"m missing something..

Dec 26 '10 at 11:51 AM ina
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3669
x504
x374
x166
x104

asked: Dec 24 '10 at 11:51 AM

Seen: 2177 times

Last Updated: Dec 24 '10 at 11:51 AM