/// Credit BinaryX, SimonDarksideJ /// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-2#post-1945602 /// Updated by SimonDarksideJ - removed dependency on a custom ScrollRect script. Now implements drag interfaces and standard Scroll Rect. /// Updated by SimonDarksideJ - major refactoring on updating current position and scroll management using System; using UnityEngine.Events; using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { [RequireComponent(typeof(ScrollRect))] [AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")] public class VerticalScrollSnap : ScrollSnapBase, IEndDragHandler { // Use this for initialization void Awake() { _scroll_rect = gameObject.GetComponent(); if (_scroll_rect.horizontalScrollbar || _scroll_rect.verticalScrollbar) { Debug.LogWarning("Warning, using scrollbars with the Scroll Snap controls is not advised as it causes unpredictable results"); } _screensContainer = _scroll_rect.content; DistributePages(); if (NextButton) NextButton.GetComponent