ScreenSwipe
ScreenSwipe copied to clipboard
ScrollRect that snaps pages to screen size. Used in production for Blackout Rugby Manager https://store.steampowered.com/app/1157960/Blackout_Rugby_Manager/
ScreenSwipe
ScrollRect that snaps pages to screen size
Install
OpenUPM
- Install with OpenUPM CLI
openupm add com.brogan89.screenswipe
UPM
-
In package manager window
Window > Package Manager
click + icon and choose "Add package from git URL...", then paste in the URLhttps://github.com/brogan89/ScreenSwipe.git
-
Alternatively add a dependency to your manifest.json in
./Packages
folder.
"com.brogan89.screenswipe": "https://github.com/brogan89/ScreenSwipe.git"
Usage
- Right click in hierarchy choose UI > Screen Swipe > Screen Swipe.
- Then do the same for Pagination.
- Drag Pagination gameObject into Pagination field in the Screen Swipe inspector.
- Do the same for the buttons if you want.
- Add more pages if you want.
- Make sure pagination toggle count is the same as the number of pages you have.
- Press play, and check it out.
See the Demo scene for best implementation.
Notes
If you want a SrollRect as child of this script then use ScrollRectEx from Unity UI Extensions. It will pass the PointerData up the heirarchy in the OnDrag events. For some reason Unity's vanilla ScrollRect doesn't allow this.
References
This script used bits of code from and inspired by:
- Unity's ScrollRect.cs
- Unity-UI-Extensions HorizontalScrollSnap