• 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
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.

avatar image
0

Answer by cscotttaakan · Dec 11, 2013 at 06:44 PM

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...

Comment
Add comment · 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
  • 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

Multiple Background Scroll - The best way to do it 0 Answers

Scroll Rect works with mouse wheel but not mouse drag? 2 Answers

Scroll view using Mesh 2 Answers

Scroll Rect not working 1 Answer

How can I programmatically tween a Scroll View to a desired position? 0 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