From a074256e92b0e33846a928eb7cdbc94d8ebad9ec Mon Sep 17 00:00:00 2001 From: hugoymh Date: Wed, 16 Oct 2024 16:21:32 +0800 Subject: [PATCH] force ScrollRect.content setup --- Runtime/Scripts/Layout/ScrollSnapBase.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Runtime/Scripts/Layout/ScrollSnapBase.cs b/Runtime/Scripts/Layout/ScrollSnapBase.cs index d200bef..bca4aa1 100644 --- a/Runtime/Scripts/Layout/ScrollSnapBase.cs +++ b/Runtime/Scripts/Layout/ScrollSnapBase.cs @@ -189,6 +189,11 @@ namespace UnityEngine.UI.Extensions _screensContainer = _scroll_rect.content; + //ScrollRect.content RT anchors has to be stretched first in order for HSS/VSS.DistributePages() to have the correct result + _screensContainer.anchorMin = Vector2.zero; + _screensContainer.anchorMax = Vector2.one; + _screensContainer.sizeDelta = Vector2.zero; + InitialiseChildObjects(); if (NextButton)