From 38d98a0fad0633a01d267472de8baf9c4e9800a4 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Wed, 4 Jan 2017 12:32:44 +0000 Subject: [PATCH] Resolution for #80 issue where onPageChanged is fired multiple times for Next/Previous. --HG-- branch : develop_5.3 --- Scripts/Layout/ScrollSnapBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index 21b9b2e..67fabf2 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -83,7 +83,7 @@ namespace UnityEngine.UI.Extensions _previousPage = _currentPage; _currentPage = value; if(MaskArea) UpdateVisible(); - ScreenChange(); + if(!_lerp) ScreenChange(); ChangeBulletsInfo(_currentPage); } } @@ -240,6 +240,7 @@ namespace UnityEngine.UI.Extensions _lerp = true; CurrentPage = _currentPage + 1; GetPositionforPage(_currentPage, ref _lerp_target); + ScreenChange(); } } @@ -253,6 +254,7 @@ namespace UnityEngine.UI.Extensions _lerp = true; CurrentPage = _currentPage - 1; GetPositionforPage(_currentPage, ref _lerp_target); + ScreenChange(); } }