diff --git a/Runtime/Scripts/Utilities/PaginationManager.cs b/Runtime/Scripts/Utilities/PaginationManager.cs
index 79ca909..c80b21f 100644
--- a/Runtime/Scripts/Utilities/PaginationManager.cs
+++ b/Runtime/Scripts/Utilities/PaginationManager.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
/// Credit Brogan King (@BroganKing)
/// Original Sourced from - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/158/pagination-script
@@ -44,7 +44,16 @@ namespace UnityEngine.UI.Extensions
scrollSnap.OnSelectionPageChangedEvent.AddListener(SetToggleGraphics);
scrollSnap.OnSelectionChangeEndEvent.AddListener(OnPageChangeEnd);
- // add selectables to list
+ ResetPaginationChildren();
+ }
+
+ ///
+ /// Remake the internal list of child toggles (m_PaginationChildren).
+ /// Used after adding/removing a toggle.
+ ///
+ public void ResetPaginationChildren()
+ {
+ // add selectables to list
m_PaginationChildren = GetComponentsInChildren().ToList();
for (int i = 0; i < m_PaginationChildren.Count; i++)
{
@@ -61,7 +70,6 @@ namespace UnityEngine.UI.Extensions
Debug.LogWarning("Uneven pagination icon to page count");
}
-
///
/// Calling from other scripts if you need to change screens programmatically
///
@@ -128,4 +136,4 @@ namespace UnityEngine.UI.Extensions
isAClick = false;
}
}
-}
\ No newline at end of file
+}