- Home /
Mouseover using GUI.Tooltip
Hi guys i have a gui button control system for my character. What i want is to have button textures change for hovering. This works when the button is active but i cant get it to change on hover (eg when you click back the texture in the guiSkin stays on back until you click another button see image)
In the script reference it explains using tooltips for mouseovers but i cant figure out how to alter it for my purpose. http://docs.unity3d.com/Documentation/ScriptReference/GUI-tooltip.html
Here is the code for my buttons
if (on){
if (GUI.RepeatButton(Rect(135,556,108,90),"")) {//up button//
movement = 1;
butSkin.button.normal.background = null;
butSkin.button.hover.background = upbut;
butSkin.button.active.background = upbutactive;
}
else{
movement = 0;
}
if (GUI.RepeatButton(Rect(102,684,120,90),"")) {
butSkin.button.normal.background = null;
butSkin.button.hover.background = downbut;
butSkin.button.active.background = downbutactive;
movement = 2;
}
Using mouseover on colliders doesnt work as the buttons end up over the top of a mesh. Restricting the area the mouse sees it.
All in all i want to change the textures in the guiSkin when i'm hovering over the button not just when i've clicked it. Any help would be great