Very newbie question. I'm trying to make a GUI box appear when I mouse over an object and disappear when the mouse is no longer on the object. I've been trying to do this by changing the alpha of the GUI box (though I feel like there may be a simpler way, like enabling and disabling the GUI...)
This is what I have so far:
var alpha = float;
function Start(){
alpha = 0;
}
function OnGUI() {
GUI.skin.box.wordWrap = true;
GUI.color.a = alpha;
GUI.Box(Rect(10,Screen.height/2+115,Screen.width-15,Screen.height/2-120),"text text text");
}
function OnMouseEnter () {
alpha = 1;
Debug.Log("mouse_enter");
}
function OnMouseExit(){
alpha = 0;
Debug.Log("mouse_exit");
}
However my script is not responding to my "alpha" variable. I tried looking for a way to enable and disable the GUI, but there doesn't seem to be an easy way too. Or I'm missing something?