diff --git a/Runtime/Scripts/Layout/HorizontalScrollSnap.cs b/Runtime/Scripts/Layout/HorizontalScrollSnap.cs index 1baacfd..a441183 100644 --- a/Runtime/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Runtime/Scripts/Layout/HorizontalScrollSnap.cs @@ -238,7 +238,7 @@ namespace UnityEngine.UI.Extensions if (JumpOnEnable || !RestartOnEnable) SetScrollContainerPosition(); if (RestartOnEnable) - GoToScreen(StartingScreen); + GoToScreen(StartingScreen, true); } /// diff --git a/Runtime/Scripts/Layout/ScrollSnapBase.cs b/Runtime/Scripts/Layout/ScrollSnapBase.cs index b8b3087..893ba29 100644 --- a/Runtime/Scripts/Layout/ScrollSnapBase.cs +++ b/Runtime/Scripts/Layout/ScrollSnapBase.cs @@ -357,7 +357,7 @@ namespace UnityEngine.UI.Extensions /// *Note, this is based on a 0 starting index - 0 to x /// /// 0 starting index of page to jump to - public void GoToScreen(int screenIndex) + public void GoToScreen(int screenIndex, bool local = false) { if (screenIndex <= _screens - 1 && screenIndex >= 0) { @@ -366,7 +366,7 @@ namespace UnityEngine.UI.Extensions _lerp = true; CurrentPage = screenIndex; GetPositionforPage(_currentPage, ref _lerp_target); - ScreenChange(); + if(local) ScreenChange(); } } @@ -623,7 +623,7 @@ namespace UnityEngine.UI.Extensions /// public void ChangePage(int page) { - GoToScreen(page); + GoToScreen(page, true); } public void OnPointerClick(PointerEventData eventData) diff --git a/Runtime/Scripts/Layout/VerticalScrollSnap.cs b/Runtime/Scripts/Layout/VerticalScrollSnap.cs index e0c5bb0..0093daa 100644 --- a/Runtime/Scripts/Layout/VerticalScrollSnap.cs +++ b/Runtime/Scripts/Layout/VerticalScrollSnap.cs @@ -228,10 +228,13 @@ namespace UnityEngine.UI.Extensions { InitialiseChildObjectsFromScene(); DistributePages(); - if (MaskArea) UpdateVisible(); + if (MaskArea) + UpdateVisible(); - if (JumpOnEnable || !RestartOnEnable) SetScrollContainerPosition(); - if(RestartOnEnable) GoToScreen(StartingScreen); + if (JumpOnEnable || !RestartOnEnable) + SetScrollContainerPosition(); + if (RestartOnEnable) + GoToScreen(StartingScreen, true); } ///