From 8a32994697623b4d10e5bbab73e536df8e734f18 Mon Sep 17 00:00:00 2001 From: Ziboo Date: Wed, 30 Sep 2015 09:55:31 +0000 Subject: [PATCH] Change how children are resize. Using rect.width & rect.height instead of sizeDelta. Like that you can have the top container use stretch anchors --HG-- branch : Ziboo/change-how-children-are-resize-using-rec-1443606808122 --- Scripts/Layout/HorizontalScrollSnap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index d2e6f2a..d15d3d4 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -211,7 +211,7 @@ namespace UnityEngine.UI.Extensions RectTransform child = _screensContainer.transform.GetChild(i).gameObject.GetComponent(); currentXPosition = _offset + i * _step; child.anchoredPosition = new Vector2(currentXPosition, 0f); - child.sizeDelta = new Vector2(gameObject.GetComponent().sizeDelta.x, gameObject.GetComponent().sizeDelta.y); + child.sizeDelta = new Vector2(gameObject.GetComponent().rect.width, gameObject.GetComponent().rect.height); } _dimension = currentXPosition + _offset * -1;