customStyles-question

Hi,

I’ve got the following code:

if (GUILayout.Button("unity",GUI.skin.customStyles[3])) {
print("unity");
}

As far as I know, the button takes the attributes I defined in customSt.3
The Text Color in the “Normal”-State is white and in fact in the app it’s white.
But the hover-color (black) doesn’t run.
It keeps the white color.
The print-output is running fine, so the button is allocated correctly.

What’s the error or isn’t this the right way?

Thx
Alex

Is there a texture assigned to the hover state? Does it work if you assign a texture to the hover state? If the answer is yes —> Report bug :smile:

Think i actually came across this just forget to report it.

First there was standing “Missing Texture”.
Tried it with an texture and it was running.

But the Text Color isn’t working without an texture/image.

Will report this.

juchee found an error… :wink:

As a solution, create images with the desired words…

That is by design. If you do not have a texture assigned to a StyleState, it’s text color is ignored.

The reason for this (admittedly slightly weird) behaviour is to avoid having to set the color many times when you just want to make a, say, red-texted button.

Hi,

I know that this post was from several years ago, but I am having this same problem; I have a text-only button (no textures) that keeps its ‘Normal’ color upon Hover even when its Hover-color is changed in the GUIskin. Is there anyway to make unity NOT ignore text color now-a-days? Or do i need to create textures with the text that I want in order to acheive the same effect?

Thanks!!

I’ve searched around for this.

I’m guessing 4 years down the road they still require you to use a texture as well.

There must be a reason for it, unknown by me though!

What the problem?
Assign same texture as normal. Or if you want to do not draw graphics in state - assign 1x1 alpha-transparent texture.