- Home /
Problems controlling the GUI skin / style
I'm having a lot of problems controlling the look of the GUI. Altough I can create a styles from scratch which is ok for some things , I'm often quite happy to use the existing Skin with my own tweaks. And cloning a style and modifying it generally works for me but not for all things.
Questions and Problems I'm facing:
I can't seem to turn off the onHover behaviour. I tried modifying the GUI.skin.button.onHover directly. Basically I want to turn onHover off.
I can't figure out how certain things are created in the default skin. How do they achieve the round corners? It doesnt seem to be a background image as it scales really well and the corners are always a consistent size.
Is it possible to clone the default GUI skin so its a visible entity in the inspector (I'm sure I saw post about this somewhere some time back but cannot find it)
Answer by Lttldude · Apr 15, 2012 at 11:14 AM
1) Make the onHover behavior the same as the onNormal behavior (color and background).
2) The round corners are achieve by the border settings under the button. "Border: Number of pixels on each side of the Background image that are not affected by the scale of the Control' shape"
3) Yea!! You can find them at this link and even edit them in Photoshop or Gimp.
Good Luck.
Thanks for the prompt response.
1) I tried:
GUI.skin.button.onHover=GUI.skin.button.onNormal;
I also tried creating a new GUIStyleState without any success. On hover behaviour is inheritted from somewhere or I'm not setting right (highly probable)
2) Oh... there is no mention that they are round ok. I will play with that.
3) Will check out that link.
thanks,
Fab
1) Create a custom GUI skin. Then you can set the text color and background image for onHover to the same as the onNormal buttons.
2) The border setting only works with backgrounds that already have rounded edges. When you take a look at the file from that link, you'll see what I mean.
Got other stuff working appart from the first point. No succeeded in making the hover style the same as active.
No success? Even when creating a new GUI Skin? I just did that on one of my projects and it seemed to work. Hmmm.
Afraid not. There is something dumb I'm missing for sure just havnt worked out that it is. I thought it was because the nuances between Hover or Active and On and not , but also not.
I've have to move to other things just to keep my sanity. Its bugging the hell out of me now.
Problem is on iOS, the last thing you touch has a hover permantely on. Which means it not obvious what the selection is.
I due course I will redesign my own skin from scratch but its driving me nuts that I cant seem to clone and mod the default skin.
Answer by JojoJonas · Apr 21, 2012 at 04:05 PM
Figured out the problem. It doesn't make much sense to me, but the window with the white border shows up during GUIStyle.onNormal (didn't really see what .Active and .Focused are used for)
So I did the following:
GUIStyle style = new GUIStyle(GUI.skin.GetStyle("Window")); //Or whatever
style.onNormal = style.normal;
GUI.Window(0, new Rect(windowX, windowY, 600, 450), myWindow, "Menu", style);
and it worked for me! Let me know if it does for you.
Your answer
Follow this Question
Related Questions
Understanding GUISkin/GUIStyle BackgroundImage and Border 2 Answers
Simple GUI Question 1 Answer
How to make a GUI that isnt alpha transparent? 1 Answer
GUIStyle Border Pixels 0 Answers
Automatic new line 1 Answer