diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index f918364..8764619 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -340,9 +340,10 @@ namespace UnityEngine.UI.Extensions private void OnValidate() { - if (_screensContainer || ChildObjects != null) + var children = gameObject.GetComponent().content.childCount; + if (children != 0 || ChildObjects != null) { - var childCount = ChildObjects == null ? _screensContainer.childCount : ChildObjects.Length; + var childCount = ChildObjects == null || ChildObjects.Length == 0 ? children : ChildObjects.Length; if (StartingScreen > childCount - 1) { StartingScreen = childCount - 1; diff --git a/UnityUIExtensions.unitypackage b/UnityUIExtensions.unitypackage index b7422c6..aefe528 100644 Binary files a/UnityUIExtensions.unitypackage and b/UnityUIExtensions.unitypackage differ