diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index daf84d8..8c10a26 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -139,6 +139,18 @@ namespace UnityEngine.UI.Extensions } } + //Function for switching to a specific screen + public void GoToScreen(int screenIndex) + { + if (screenIndex <= _screens && screenIndex >= 0) + { + _lerp = true; + _lerp_target = _positions[screenIndex]; + + ChangeBulletsInfo(screenIndex); + } + } + //Because the CurrentScreen function is not so reliable, these are the functions used for swipes private void NextScreenCommand() { diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index 27b9c9d..81dd390 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -137,6 +137,18 @@ namespace UnityEngine.UI.Extensions } } + //Function for switching to a specific screen + public void GoToScreen(int screenIndex) + { + if (screenIndex <= _screens && screenIndex >= 0) + { + _lerp = true; + _lerp_target = _positions[screenIndex]; + + ChangeBulletsInfo(screenIndex); + } + } + //Because the CurrentScreen function is not so reliable, these are the functions used for swipes private void NextScreenCommand() {