I can for the life of me not remove the scroll bar on a scroll view.
I am using GUI.BeginScrollView to create a scroll view and have rewritten it so that it’s a swipe to scroll the view. It works well, now I want to remove the vertical scroll bar.
I have tried setting GUI.skin.verticalScrollbar to other styles but that just throws errors saying it cant find different buttons.
How do I remove the scroll bar from a scroll view?
Having just come across this problem the solution is to use GUIStyle.none as stated in other answers but if you only put in one thats just for the horizontal bar. You must put it in twice for the Horizontal and Vertical bars
You can create a GUI.HorizontalScrollbar which will not have a vertical one.
Also check the parameters you are passing to the function, to make sure you don’t have alwaysShowVertical set to true.
And finally, make sure the height of the content inside the ScrollView is actually smaller than the view size.
I don't want any scroll bar's at all. I have alwaysShowVertical set to false. I need a larger content area then the scroll area so that I can show more than what fits on the screen. It's for Android so the resolution is limited.
Straight outta my coding - the first false is for horizontal bars, second for vertical bars.
var scrollPosition : Vector2;
var width : int;
var height : int;
scrollPosition = GUILayout.BeginScrollView (scrollPosition, false, false, GUILayout.Width(width), GUILayout.Height(height));
Setting alwaysShowHorizontal and alwaysShowVertical to false will not remove them if the content area is larger than the scroll area. Setting them to true will just show them even if they are not needed.
Thx for the link. I had already tried all the suggestions on the page, except the GUIX class. I am reluctant to use it as I am trying to learn how everything works, so want to write it myself. I know i know, re-inventing the wheel and stuff like that :-)
Maybe this might help? I’ve written this little helper some time ago bacause someone already was in need of hiding the scrollbars ;). I’m a bit confused, when you said you’ve rewritten the ScrollView, why have you implemented the scrollbars? Did you mean you have “wrapped” GUI.BeginScrollView?
I’ve written a wrapper class for BeginScrollView that works with touch input as well, however the class is part of my menu system which i can’t publish
To hide the GUI Scrollbar you have to disable the texture in a GUISkin. The reason GUIStyle doesn’t work is because it doesn’t have settings for a scrollbar in there. Also make sure to put your scrollview function AFTER GUI.skin = skin.
This is the correct answer because I couldn’t figure it out for the life of me…
and what style do we create when we want to view one of the 2 bars?
– TomArano_DimencoThis is well out of date. This is the old gui system that you should not be using.
– gheeler