Closed jpetays closed 3 months ago
PageScroller.SetPage does not report previous page correctly but it is always 0.
public void SetPage(int index) { _scrollRect.horizontalNormalizedPosition = GetTargetPagePosition(index); _targetPage = index; _currentPage = index; OnPageChangeEnded?.Invoke(0, _currentPage); }
I fixed this
public void SetPage(int index) { _scrollRect.horizontalNormalizedPosition = GetTargetPagePosition(index); var previousPage = _currentPage; _targetPage = index; _currentPage = index; OnPageChangeEnded?.Invoke(previousPage, _currentPage); }
After this dots seems to reflect current page state correctly.
I created buttons to set desired page programmatically.
public class TestButton : MonoBehaviour { [SerializeField] private PageScroller _pageScroller; [SerializeField] private int _pageIndex; private Button _button; private void Awake() { _button = GetComponent<Button>(); _button.onClick.AddListener(() => { _pageScroller.SetPage(_pageIndex); }); } }
Fixed in develop. Will be in the next release. Thanks!
PageScroller.SetPage does not report previous page correctly but it is always 0.
I fixed this
After this dots seems to reflect current page state correctly.
I created buttons to set desired page programmatically.