I would like a GUI slider to appear and stay when the user clicks on an individual game object. Then I would like the user to be able to slide the slider and the g.o.'s alpha value changes. In doing so, this is what I have so far:
var slider : float=1;
var mouseToggle : boolean;
function OnMouseDown (){
mouseToggle = !mouseToggle;
}
function OnGUI () {
if (mouseToggle){
slider = GUI.HorizontalSlider( Rect(20,135,175,30), slider, 0.0, 1.0);
renderer.material.color.a = slider;
}
}
However, the slider does not appear when I click on the appropriate g.o. I posted in UnityAnswers already (see here) and subsequently tried different Input keys, but all unsuccessfully. ![]()
There are several different g.o.s, each of which will have its own slider (among other GUI elements). I would like to activate each individual game object’s gui when OnMouseDown clicks on a new g.o.
Let me know if this makes sense.