diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index 54b4a02..74e0e64 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -35,7 +35,7 @@ namespace UnityEngine.UI.Extensions } else if (_lerp) { - _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime); + _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * (UseTimeScale ? Time.deltaTime : Time.unscaledDeltaTime)); if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f) { _screensContainer.localPosition = _lerp_target; @@ -292,4 +292,4 @@ namespace UnityEngine.UI.Extensions } #endregion } -} \ No newline at end of file +} diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index 6829fa7..4b1a8aa 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -76,6 +76,9 @@ namespace UnityEngine.UI.Extensions [Tooltip("Speed at which the ScrollRect will keep scrolling before slowing down and stopping (optional)")] public int SwipeVelocityThreshold = 100; + [Tooltip("Use time scale instead of unscaled time (optional)")] + public Boolean UseTimeScale = true; + [Tooltip("The visible bounds area, controls which items are visible/enabled. *Note Should use a RectMask. (optional)")] public RectTransform MaskArea; @@ -592,4 +595,4 @@ namespace UnityEngine.UI.Extensions } #endregion } -} \ No newline at end of file +} diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index 7599eca..4c9167c 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -35,7 +35,7 @@ namespace UnityEngine.UI.Extensions } else if (_lerp) { - _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime); + _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * (UseTimeScale ? Time.deltaTime : Time.unscaledDeltaTime)); if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f) { _screensContainer.localPosition = _lerp_target; @@ -291,4 +291,4 @@ namespace UnityEngine.UI.Extensions } #endregion } -} \ No newline at end of file +}