• 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
1
Question by erebel55 · Jan 29, 2015 at 05:44 PM · uibuttonsscrollrect

Scrolling Scroll Rect with Buttons

I am trying to create something like the following for my level selection

alt text

So, I want to allow the player to scroll through the levels by clicking the left/right arrows.

By using Scroll Rect I can create something like this easily. However, I don't see a way to implement the buttons instead of a drag or scrollbar.

I tried creating two Buttons at a higher level than the Scroll Rect (so they aren't scrolled out of view as well).

However, I don't see what function I can call in my On Click in order to scroll the Scroll Rect.

Anyone know if this is possible?

Thank you

scroll.png (283.2 kB)
Comment
Add comment · Show 1
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 e4ajith · Jun 10, 2016 at 09:12 AM 0
Share

Any luck with this? Please share if you got something.

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by mingom · Feb 26, 2016 at 08:15 PM

use UI.ScrollRect.horizontalNormalizedPosition.

http://docs.unity3d.com/460/Documentation/ScriptReference/UI.ScrollRect-horizontalNormalizedPosition.html

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 mingom · Jun 10, 2016 at 01:37 PM 0
Share

Or use a coroutine and lerp the UI.ScrollRect.horizontalNormalizedPosition for the size of one element on each click. Need more details?

avatar image
2

Answer by Eloquentist · Oct 13, 2016 at 06:59 AM

This video explain how to do this:

https://www.youtube.com/watch?v=yC_LqOv2JDw

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
avatar image
1

Answer by Brijs · Jun 10, 2016 at 12:09 PM

Modify ScrollRect.velocity property as per your need when you click button.

Set ScrollRect.decelerationRate for smoothness as per your need.

or change position of content of scrollrect

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
avatar image
1

Answer by jinincarnate · Apr 09, 2020 at 02:37 PM

Anyone still looking for answer I created a github repository with a sample scene. here

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

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

4.6 UI Text rect does not expand automatically 2 Answers

Scroll Rect in Web GL 5.4 0 Answers

how to make UI Image inside Scroll Rect (ScrollRect) autoscroll? 1 Answer

Unity 4.6 UI button highlight color staying after button clicked 11 Answers

ScrollRect - Scroll outside the rect!? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges