• 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
Question by martin-protostar · Feb 16, 2016 at 01:00 PM · uiguiscrollviewscrollscrollbar

How to disable ScrollView dragging

I have a scrollview that scrolls when I drag and when I use the scrollbar, but I want to disable dragging the scrollview. How do I do that?

Comment
Geoxion
piterpiper
ulissescad

People who like this

3 Show 0
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

4 Replies

· Add your reply
  • Sort: 
avatar image

Answer by martin-protostar · Feb 19, 2016 at 12:41 AM

To disable dragging, set Vertical & Horizontal Scroll to false, then it can only be controlled by a scrollbar.

Comment
Geoxion
calpolican
ulissescad
rimmarpl

People who like this

2 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 calpolican · Feb 15, 2018 at 02:28 AM 0
Share

Tried this and the scrollbar disappeared. In my opinion it's a false statement, but if I missed something please tell.

avatar image huulong calpolican · Jun 29, 2022 at 02:23 PM 0
Share

Yes, this happens when Vertical/Horizontal Scrollbar Visibility is set to Permanent. Because unchecking Vertical/Horizontal actually means you want to disable scrolling completely and so Unity thinks that you don't need the scrollbar at all.

With visibility "Auto Hide" and "Auto Hide (and Expand Viewport)" it works, but that's still a hack I think? (as you're not supposed to scroll in this case; scrollbar just happens to still be plugged)

avatar image ulissescad · Sep 19, 2019 at 07:40 PM 0
Share

Thanks, help me a lot!

avatar image huulong · Jun 29, 2022 at 02:24 PM 0
Share

Remember to set visibility to "Auto Hide" or "Auto Hide (and Expand Viewport)" for it to work (see my other comment replying to calpolican).

Also note that if you press on a button inside the scrollable content and move the cursor a little too much before releasing the mouse button (or touch), the click action won't be registered.

avatar image

Answer by panayiotismilios · Aug 18, 2020 at 04:20 PM

In the ScrollView object, set the movement Type from Elastic to Clamped

Comment
Dance_M
xpiredmemes
huulong

People who like this

1 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 huulong · Jun 29, 2022 at 02:24 PM 0
Share

I tried it, and it changes the way it scrolls when dragged, but not disable dragging itself.

avatar image

Answer by renanbp · May 20, 2020 at 03:58 AM

I think I just found the answer. In the inspector for the ScrollRect Monobehavior, if you remove the reference to the Viewport there (set it to none), it appears that it solves the problem without causing any other issues. (Probably that's the only use for this reference, since the Content is the one manipulated by the scrolling)

Comment
larry2013z
huulong

People who like this

0 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 huulong · Jun 29, 2022 at 02:26 PM 0
Share

Sorry, it didn't solve the issue for me, and the inspector even complains if using some Auto Hide visibility.

avatar image

Answer by vin4bacchus · Sep 28, 2021 at 06:20 PM

In the ScrollRect script inspector of the ScrollView object, unclick the Horizontal checkbox directly below Content. This prevents dragging horizontally. Likewise the Vertical checkbox controls vertically. The scroll view can only be scrolled programmatically after unchecking.

Comment

People who like this

0 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 huulong · Jun 29, 2022 at 02:28 PM 0
Share

To be more exact, the scrollbar will also work in Auto Hide visiblity, no idea if it's a bug or by design. See my comments on martin-protostar 's post (which is similar to this answer).

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

9 People are following this question.

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

Related Questions

Scroll Rect Min/Max Size 0 Answers

Where can I edit UI.ScrollView? 0 Answers

Scroll Rect doesn't display items Unity 5.6 2 Answers

UGUI ScrollRect automatic scroll? (Chat) 1 Answer

ScrollRect scrollbar drag being overridden and stuttering to top 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