Hey Guys,
I have a simple Question related to the Scrollbar GUI Element.
I want to make an Inventory for a Third Person Game.
Now I’m still wondering how to get the correct value of a Scrollbar.
There’s 0 as the minimum Value and 1 as the maximum.
float scrollbarKnobWidth = 0;
int srollbarValue =
GUI.HorizontalScrollbar(new Rect(0, 0, Screen.width, 15),srollbarValue, scrollbarKnobWidth, 0, 1);
Now I want to change the ‘scrollbarKnobWidth’ related to the count of Items that are in the Inventory.
For Example I set the Value to ‘0.6’. In this case I get values from 0 to 0.6 instead of 0 to 1 if I pull the Knob from the left to the right.
Is there a simple way to get always a value between the same minimum and maximum borders independent to the knobwidth?