Added error handling around setting Unity UI Components for Vertical/Horizontal scrolling
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/296pull/413/head
parent
85ee380ee9
commit
a317663268
|
@ -114,12 +114,20 @@ namespace UnityEngine.UI.Extensions
|
|||
/// <param name="WorldPositionStays">Should the world position be updated to it's parent transform?</param>
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -114,7 +114,13 @@ namespace UnityEngine.UI.Extensions
|
|||
/// <param name="WorldPositionStays">Should the world position be updated to it's parent transform?</param>
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue