Your code suggests that you've added a custom style named "custom_style" to a GUISkin that has been assigned in your game.
You need to assign your GUISkin in the OnGUI function, which looks something like this:
var myCustomSkin : GUISkin;
function OnGUI()
{
GUI.skin = myCustomSkin;
}
Also, onHover only applies to toggle buttons that are in their "on" state. You want to use hover in stead.
Also, if you don't have a background image associated with the hover state, it won't work.
The states that don't have background images are ignored.
thanks jahroy. I had already done that assignment, however I didn't know that onHover only works with Toggle. On GUILayout.Label documentation it is written: "Labels have no user interaction, do not catch mouse clicks and are always rendered in normal style. If you want to make a control that responds visually to user input, use a Box control" http://unity3d.com/support/documentation/ScriptReference/GUILayout.Label.html that's why I was expecting that a Box would handle onHover events. Regarding the background images limitation, is the use of a transparent png a valid workaround?
You can set the textcolor on the GUIStyleState for the appropriate mode(s) that you need it for (probably onHover in your case). You can do this through the inspector or code.
thanks jahroy. I had already done that assignment, however I didn't know that onHover only works with Toggle. On GUILayout.Label documentation it is written: "Labels have no user interaction, do not catch mouse clicks and are always rendered in normal style. If you want to make a control that responds visually to user input, use a Box control" http://unity3d.com/support/documentation/ScriptReference/GUILayout.Label.html that's why I was expecting that a Box would handle onHover events. Regarding the background images limitation, is the use of a transparent png a valid workaround?
– andrespI remember experiencing similar expectations! That sounds like a perfect workaround to me. You could make it a 1 pixel image if you like.
– jahroyYou could use a transparent PNG as the background image as well.
– Canadian_Hobo