Unity UI Scroll Snaps Unity UI Scroll Snaps is a new open source project focused on creating robust components for all of your scrolling and snapping needs. This was originally inspired by an idea I had for a menu system where you could scroll and select item options, but even though I saw some amazing extensions of the Unity Scroll Rect I couldn't find any solutions that had adaptable spacing for different sized items, so I decided to create one myself! After much tinkering and many additions I decided the script I'd written was ready to take it's first steps into the broader world, and maybe even meet some other friendly Scroll Snap scripts out there! New Version! This project now has a new Version 1, completely rewritten from scratch! You can go here to check it out, and learn why this change has happened. Version 0 is still (for now) the official version because it is the most fully featured, but in the future cool stuff will be happening over there. Creative Tenets Components should be as self-contained as possible, ease of installment for the user takes priority over minimizing duplicate code. Components should not rely on vanilla Unity Components like Scroll Rects, they should handle whatever they need to do themselves, to make it easier for the user. What you see is what you get, when the user is setting up the component in the editor it should look the same as how it will look when they run it. All of these things help ensure a good experience for the user. No more making sure you have the 5 scripts this component needs to function, no more redundant components cluttering up your gameobjects, and especially no more uncertainty about how something will look after you hit play. Contributing This project is specifically for Scroll Snaps, things that scroll and then snap to items. If you have a lovely UI component that you're just dying to put somewhere, but it doesn't have to do with scroll snaps, consider contributing it to the Unity UI Extensions project. If you do indeed have a Scroll Snap component that you want to show the world we would love to take it! You can find out more about contributing here and here. Just be prepared PRs will probably get commented on Downloading Download instructions can be found here, or if you just want the latest asset package right now here it is for your enjoyment. List of All the Things Examples of "all the things" in action are part of the asset package or can be downloaded individually here. You can also check out the List of All the Things for Version 1 here. Spoiler: Components Directional Scroll Snap The Directional Scroll Snap is based on the idea of the scrollable item menu. Items are "snapped to" (aligned with the center of the Directional Scroll Snap) along one axis so that it either scrolls vertically or horizontally. The Directional Scroll Snap also snaps to items pivots not their centers (although you can set it to their center) to give you more options in how you animate & organize your items. Options Include: Moving Horizontally or Vertically Locking or Unlocking the non-moving direction. (so it can be loosey goosey if you want) Looping functionality Use velocity when snapping, or don't. Different snap types: snap to nearest, snap to last passed, and snap to next. Different Interpolators for scrolling animations, it can overshoot, anticipate, do a little dance, ect. The ability to override Interpolators (among other things) for different input types. Button control for going back (up/left) and forward (down/right) Scrollbar control (which can use velocity or not, whatever suites your fancy) Scroll wheel & touch pad control (ditto above) Mouse pointer & touch control (you get the drill) Filtering of items, you can tell the Scroll Snap what it is and is not allowed to snap to, and what it is and is not allowed to calculate its size with. So you can have unsnap-to-able descriptive text & decorative edging that stretches to the size of the content. So pretty! Supports placing items "by hand" (whatever that means) as well as Horizontal Layout Group, Vertical Layout Group, and Grid Layout Group. Supports populating and editting the Scroll Snap at runtime through functions like: InsertChild, RemoveChild, SetChildSnappability and more. Plus lots of Unity events to hook into including, but not limited to: Start Movement, Snapped to Item, and Closest Item Changed. Omni Directional Scroll Snap The Omni Directional Scroll Snap is based on the idea of the item/skill tree. The intention being that you could move the Scroll Snap vertically, horizontally, diagonally... or even a bit of each, and when you stopped moving it it would snap to the nearest item. When the Omni Directional Scroll Snap snaps to an item it aligns the item both horizontally and vertically, so the pivot of the item is at the dead center of the Scroll Snap. Options Include: Using velocity when snapping, or not. Different Interpolators for scrolling animations, including crowd favorites like: Viscous Fluid, Overshoot, Accelerate Decelerate, and many more. The ability to override interpolators (among other things) for different input types. Any control method you can think of! We've got scrollbar control, scroll wheel control, touch pads, mouse drags, and touch control. Filtering of Items, letting you tell the Scroll Snap what it is allowed to snap to, and what it is allowed to calculate its size with. So you can add some some lovely unsnap-to-able lines between the items in your skill tree, and decorative edging that stretches to the size of the content. All the options you could only dream of! Supports placing items with individual love and care, or throwing them in a Layout Group (Horizontal Layout Group, Vertical Layout Group, or Grid Layout Group) and letting the computer do the work. Supports populating and editting the Scroll Snap at runtime through functions like: InsertChild, RemoveChild, SetChildSnappability and more. Plus 5 different Unity Events you can hook into including (but not limited to) your old friend On Value Changed, your new friend Start Movement Event, and your new new friend On Closest Item Changed. Spoiler: Helper Classes Scroller The Scroller is based on the Android Open Source Project's Scroller. It makes it easy to move something from point A to point B in way that's cleaner and more robust than simple lerping. Options Include: Interpolators for scrolling animations. It comes with a smattering of built in interpolators that allow you to change up your scrolling animations, such as Viscous Fluid, Overshoot, and Anticipate, or you can create your own interpolator for it to use. Animations based on velocity (Flings) and animations based on duration (Scrolls). Functions for calculating where a Fling will land before it has been flung.