- Home /
What's the difference between Normal and OnNormal in GUIStyle
Hello, everyone! I am confused about the difference between Normal and OnNormal and others like Hover and OnHover etc in GUIStyle, especially the OnNormal state, i do not know when i works. Just take the Normal and OnNormal as an example, The official document says:"Background image & Text Color of the Control in enabled state". I am not very clear about this statement. Does it mean the OnNormal works just at the moment when its state changed form disabled to enabled? Any reply will be appreciated!
If you look at the GUIStyle.Draw method, some of the overloads take a "bool on" parameter. If true, then the "on" version of the styling will be used.
Answer by Owen-Reynolds · Mar 28, 2011 at 08:14 PM
The "ON" settings are for a Toggle which has been clicked into the ON state. For example, OnNormal is after you've clicked it ON and moved the mouse away.
Regular buttons, textfields... don't seem to use any of the "On" family.
Answer by Jason B · Mar 29, 2011 at 12:52 AM
Typically putting "On" before something indicates that something will fire the FIRST time that action occurs. So OnHover would occur on the frame your mouse begins to hover, but not subsequently. And Hover would be what occurs as your mouse continues to hover over some period of time.
Logically, this means that if you have a button with an OnHover color of blue, and a Hover color of green, moving your mouse over it will cause it to turn blue for a fraction of a second, and then it will be green until you take your mouse off.
Likewise, OnNormal would occur when the GUI object becomes normal, and Normal would be what occurs while time is passing and it is normal.
If that all makes sense.
Honestly there's no purpose I can discern from having OnNormal and OnHover etc. as part of the style, though it could be useful to route those happenings through scripts to make fancy GUI effects (like telling a button it can slowly begin glowing brighter OnHover, and OnNormal it can slowly fade back to normal).
Thanks for your reply. I do not know have i realized your opinion, OnNormal just take a fraction of a second even that we can not aware of its change? I tested it in my scene, and could not find the effect of OnNormal. Is it too fast? And are there any method or some codes that can demonstrate OnNormal's effect? Thanks.
Hi, i am clear now, just as Owen Reynolds said above, Regular buttons, textfields... don't seem to use any of the "On" family, The "ON" settings are for a Toggle.
Your answer
![](https://koobas.hobune.stream/wayback/20220613115325im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Access custom style from skin via string 1 Answer
Understanding GUISkin/GUIStyle BackgroundImage and Border 2 Answers
Background of GUI.TextField disappears when using a GUIStyle 2 Answers
Optimizing OnGUI - Too many gui elements? 2 Answers
Changing a GUIStyle for a button from Java Script to C# 2 Answers