Protecting Remove too

pull/413/head
Simon Jackson 2022-12-24 12:45:31 +00:00
parent a317663268
commit 35c778f5f7
2 changed files with 12 additions and 2 deletions

View File

@ -157,7 +157,12 @@ namespace UnityEngine.UI.Extensions
{
return;
}
_scroll_rect.horizontalNormalizedPosition = 0;
try
{
// Rare instances of Unity bug cause error, adding try to manage it.
_scroll_rect.horizontalNormalizedPosition = 0;
}
catch { }
Transform child = _screensContainer.transform.GetChild(index);
child.SetParent(null, WorldPositionStays);

View File

@ -154,7 +154,12 @@ namespace UnityEngine.UI.Extensions
{
return;
}
_scroll_rect.verticalNormalizedPosition = 0;
try
{
// Rare instances of Unity bug cause error, adding try to manage it.
_scroll_rect.verticalNormalizedPosition = 0;
}
catch { }
Transform child = _screensContainer.transform.GetChild(index);
child.SetParent(null, WorldPositionStays);