Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rasp1977 · Apr 14, 2013 at 07:34 PM · scrollviewscrollremovebar

How to remove/hide GUI scroll bar

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?

Best regards Rasp1977

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

7 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by gheeler · Jun 11, 2014 at 11:04 AM

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

This is how Im using it

         scrollPos = GUILayout.BeginScrollView (scrollPos, GUIStyle.none, GUIStyle.none, GUILayout.Width (Screen.width), GUILayout.Height (Screen.height - 155));
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TomArano_Dimenco · Dec 10, 2020 at 03:56 PM 0
Share

and what style do we create when we want to view one of the 2 bars?

avatar image Bunny83 TomArano_Dimenco · Dec 11, 2020 at 05:42 PM 0
Share

You have to use either

 GUI.skin.horizontalScrollbar

or

 GUI.skin.verticalScrollbar

or of course you can use your own style if you like.

avatar image gheeler · Dec 10, 2020 at 04:01 PM 0
Share

This is well out of date. This is the old gui system that you should not be using.

avatar image Bunny83 gheeler · Dec 11, 2020 at 05:39 PM 0
Share

It's not out of date. It's just the immediate mode GUI which is still used by the Unity editor and all editor scripts

avatar image
0

Answer by ricardo_arango · Apr 15, 2013 at 02:51 AM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rasp1977 · Apr 16, 2013 at 08:20 AM 0
Share

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.

avatar image
0

Answer by xKroniK13x · Apr 15, 2013 at 03:06 AM

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));
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rasp1977 · Apr 16, 2013 at 08:18 AM 1
Share

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.

avatar image
0

Answer by Rasp1977 · Apr 16, 2013 at 10:29 AM

I have worked around it in a very ugly manor that only works because I use the entire screen for the scroll area.

I have set the scroll area to be larger than the screen so that vertical scroll bar is drawn outside the screen.

This is stupid and I hate it. So if anyone knows of a way to disable the scrollbars or hide them. Please let me know.

I am using Unity 3.5, so preferably something that works with that version.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image xKroniK13x · Apr 16, 2013 at 01:29 PM 0
Share

I found this on the forum that may help.http://forum.unity3d.com/threads/29605-Hide-BeginScrollView-scrollbars

avatar image Rasp1977 · Apr 16, 2013 at 04:11 PM 0
Share

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 :-)

avatar image
0

Answer by Bunny83 · Apr 16, 2013 at 02:04 PM

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 ;)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rasp1977 · Apr 16, 2013 at 04:19 PM 0
Share

Actually what I meant was that I just rewrote the interface to scroll the view to touchscreen, so it works like every other android scroll menu.

I have looked through your class and what you do is to wrap everything yourself "very nice if I must say so" and prevent it from using vertical or horizontal scroll bar.

I would like a way to hide the bars in the default scroll view and I find it hard to believe that no one at Unity never had the need to hide it and therefore forgot to add a way to do it.

I have "solved" my problem for the moment, but I really want to use the right official way of doing it.

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ScrollBar on for loops 0 Answers

Scrollview is positioning things incorrectly 1 Answer

Why is my scrollbar not working? 4 Answers

Auto Scroll To Selected Button in Grid When Outside Viewport 2 Answers

Disabling mouse wheel when user is scrolling ScrollView 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges