Thank you first for coming in to help.
Anyway, I want to know if it’s possible for me to use the horizontal scrollbar in unity
var hScrollbarValue : float;
function OnGUI () {
hScrollbarValue = GUI.HorizontalScrollbar (Rect (25, 25, 100, 30), hScrollbarValue, 1.0, 0.0, 10.0);
}
to create one that moves automatically left and right and stops when you hit spacebar or onmouse click. If so, would anyone be kind enough to point me in the right direction as to which API to use and I’ll figure my way out from there? Thanks again.
Thank you first for coming in to help.
Anyway, I want to know if it’s possible for me to use the horizontal scrollbar in unity
var hScrollbarValue : float;
function OnGUI () {
hScrollbarValue = GUI.HorizontalScrollbar (Rect (25, 25, 100, 30), hScrollbarValue, 1.0, 0.0, 10.0);
}
to create one that moves automatically left and right and stops when you hit spacebar or onmouse click. If so, would anyone be kind enough to point me in the right direction as to which API to use and I’ll figure my way out from there? Thanks again.
not sure of the syntax for hScrollbarValue, but its your best bet
is there any way to change the max? Change it to 10000
then for every update, increase var value : float += 1
then make hscrollbarvalue the same as var value
I think that would work. Or it might have to be in a different function (i’m bad at those).
Thank you first for coming in to help.
Anyway, I want to know if it’s possible for me to use the horizontal scrollbar in unity
var hScrollbarValue : float;
function OnGUI () {
hScrollbarValue = GUI.HorizontalScrollbar (Rect (25, 25, 100, 30), hScrollbarValue, 1.0, 0.0, 10.0);
}
not sure of the syntax for hScrollbarValue, but its your best bet
is there any way to change the max? Change it to 10000
then for every update, increase var value : float += 1
then make hscrollbarvalue the same as var value
I think that would work. Or it might have to be in a different function (i’m bad at those).
to create one that moves automatically left and right and stops when you hit spacebar or onmouse click. If so, would anyone be kind enough to point me in the right direction as to which API to use and I’ll figure my way out from there? Thanks again.
Thanks for the quick reply, but what I read up was that I had to use Time.deltaTime or something close to that. Sorry, this is the first time I’m using JS for games (I normally use it for web development).
You might want to look at using a coroutine to change the value of the slider variable:-
var interrupted: boolean;
function MoveSlider() {
interrupted = false;
while (!interrupted) {
for (i = 0; i < 10 !interrupted; i++) {
hScrollBarValue = i;
yield WaitForSeconds(0.1);
}
for (i = 9; i >= 0 !interrupted; i--) {
hScrollBarValue = i;
yield WaitForSeconds(0.1);
}
}
}
You would then set the “interrupted” flag in response to the spacebar and render the slider with the hScrollBarValue as before.