From 700cbc34b961ced270c755e173f485f97dbcdf0a Mon Sep 17 00:00:00 2001 From: David Gileadi Date: Wed, 26 Jul 2017 22:44:18 -0700 Subject: [PATCH] Calculate the panel dimensions in Start to avoid scale issues --- Scripts/Layout/HorizontalScrollSnap.cs | 1 + Scripts/Layout/VerticalScrollSnap.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index 3fe3cfe..1a85021 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -16,6 +16,7 @@ namespace UnityEngine.UI.Extensions _isVertical = false; _childAnchorPoint = new Vector2(0, 0.5f); _currentPage = StartingScreen; + panelDimensions = gameObject.GetComponent().rect; UpdateLayout(); } diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index 8cb9fbf..f6be4ec 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -16,6 +16,7 @@ namespace UnityEngine.UI.Extensions _isVertical = true; _childAnchorPoint = new Vector2(0.5f,0); _currentPage = StartingScreen; + panelDimensions = gameObject.GetComponent().rect; UpdateLayout(); }