Hi guys,
I figured out that GUI.VerticalScrollbar comes without the nasty scrollView bugs (well, at least without all of them) :).
So I wanna try to use it as a (temporary) solution when writting my own scrollView.
OK, let’s read the class description for a start:
Well, I’ll just ignore the last sentence, since I do not want to use scrollViews for sure. ![]()
Now about parameters:
Not very clear what the last 4 parameters do.
“size: How much we see?” - I don’t quite get it. ![]()
Could somebody please elaborate on usage on this thing? Which parameters do I have to input to get desired percentages in the example, and what would the output value range be (amounts in the example).
Because I did some measuring on screen and figured out that the scrollbar thumb doesn’t have exactly 10%, 20% of height.
Thanks!
Here’s the code I’m using and output I’m getting:
public class VerticalScrollbarTest : MonoBehaviour
{
private float _amount1;
private float _amount2;
private float _amount3;
private float _amount4;
private float _amount5;
void OnGUI() {
if (_w < 0)
_w = GUI.skin.GetStyle("verticalscrollbar").fixedWidth;
_amount1 = GUI.VerticalScrollbar(new Rect(50, 50, _w, 400), _amount1, 100, 500, 0); // I want 20% of the size here
_amount2 = GUI.VerticalScrollbar(new Rect(50 + 50, 50, _w, 400), _amount2, 200, 500, 0); // I want 40% of the size here
_amount3 = GUI.VerticalScrollbar(new Rect(50 + 50 * 2, 50, _w, 400), _amount3, 500, 500, 0); // I want 100% of the size here
_amount4 = GUI.VerticalScrollbar(new Rect(50 + 50 * 3, 50, _w, 400), _amount4, 100, 1000, 0); // I want 10% of the size here
_amount5 = GUI.VerticalScrollbar(new Rect(50 + 50 * 4, 50, _w, 400), _amount5, 200, 1000, 0); // I want 20% of the size here
}
}
