The following code always prints "1.0":
private var someVal=1.0;
function OnGUI() {
someVal=GUI.HorizontalSlider(Rect(10,10,200,50),someVal,0.0,1.0);
}
function Update() {
print(someVal);
}
The following code always prints the correct value which I define by sliding the slider:
private var someVal=1.0;
function OnGUI() {
someVal=GUI.HorizontalSlider(Rect(10,10,200,50),someVal,0.0,1.0);
print(someVal);
}
Additionally, I don't know if this is intentional or not, but when I slide the slider, I see a ghost version of the little knob still in its original position, which I guess is intentional, but when I release the mouse button it remains there.
Obviously I want my someVal to get adjusted with the slider. Does someone know what I’m doing wrong here?