This repository was archived by the owner on Mar 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Runtime/Scripts/Utilities Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1- using System . Collections . Generic ;
1+ using System . Collections . Generic ;
22/// Credit Brogan King (@BroganKing)
33/// Original Sourced from - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/158/pagination-script
44
@@ -44,7 +44,16 @@ protected override void Start()
4444 scrollSnap . OnSelectionPageChangedEvent . AddListener ( SetToggleGraphics ) ;
4545 scrollSnap . OnSelectionChangeEndEvent . AddListener ( OnPageChangeEnd ) ;
4646
47- // add selectables to list
47+ ResetPaginationChildren ( ) ;
48+ }
49+
50+ /// <summary>
51+ /// Remake the internal list of child toggles (m_PaginationChildren).
52+ /// Used after adding/removing a toggle.
53+ /// </summary>
54+ public void ResetPaginationChildren ( )
55+ {
56+ // add selectables to list
4857 m_PaginationChildren = GetComponentsInChildren < Toggle > ( ) . ToList < Toggle > ( ) ;
4958 for ( int i = 0 ; i < m_PaginationChildren . Count ; i ++ )
5059 {
@@ -61,7 +70,6 @@ protected override void Start()
6170 Debug . LogWarning ( "Uneven pagination icon to page count" ) ;
6271 }
6372
64-
6573 /// <summary>
6674 /// Calling from other scripts if you need to change screens programmatically
6775 /// </summary>
@@ -128,4 +136,4 @@ private void OnPageChangeEnd(int pageNo)
128136 isAClick = false ;
129137 }
130138 }
131- }
139+ }
You can’t perform that action at this time.
0 commit comments