diff --git a/Runtime/Scripts/Layout/HorizontalScrollSnap.cs b/Runtime/Scripts/Layout/HorizontalScrollSnap.cs
index f6de775..365c1a9 100644
--- a/Runtime/Scripts/Layout/HorizontalScrollSnap.cs
+++ b/Runtime/Scripts/Layout/HorizontalScrollSnap.cs
@@ -114,12 +114,20 @@ namespace UnityEngine.UI.Extensions
/// Should the world position be updated to it's parent transform?
public void AddChild(GameObject GO, bool WorldPositionStays)
{
- _scroll_rect.horizontalNormalizedPosition = 0;
+ try
+ {
+ // Rare instances of Unity bug cause error, adding try to manage it.
+ _scroll_rect.horizontalNormalizedPosition = 0;
+ }
+ catch { }
+
GO.transform.SetParent(_screensContainer, WorldPositionStays);
InitialiseChildObjectsFromScene();
DistributePages();
if (MaskArea)
+ {
UpdateVisible();
+ }
SetScrollContainerPosition();
}
diff --git a/Runtime/Scripts/Layout/VerticalScrollSnap.cs b/Runtime/Scripts/Layout/VerticalScrollSnap.cs
index 58bde93..4493d8b 100644
--- a/Runtime/Scripts/Layout/VerticalScrollSnap.cs
+++ b/Runtime/Scripts/Layout/VerticalScrollSnap.cs
@@ -114,7 +114,13 @@ namespace UnityEngine.UI.Extensions
/// Should the world position be updated to it's parent transform?
public void AddChild(GameObject GO, bool WorldPositionStays)
{
- _scroll_rect.verticalNormalizedPosition = 0;
+ try
+ {
+ // Rare instances of Unity bug cause error, adding try to manage it.
+ _scroll_rect.verticalNormalizedPosition = 0;
+ }
+ catch { }
+
GO.transform.SetParent(_screensContainer, WorldPositionStays);
InitialiseChildObjectsFromScene();
DistributePages();