diff --git a/Runtime/Scripts/Layout/CurvedLayout.cs b/Runtime/Scripts/Layout/CurvedLayout.cs index fdc3637..c3fddc2 100644 --- a/Runtime/Scripts/Layout/CurvedLayout.cs +++ b/Runtime/Scripts/Layout/CurvedLayout.cs @@ -29,6 +29,13 @@ namespace UnityEngine.UI.Extensions public float centerpoint = 0.5f; protected override void OnEnable() { base.OnEnable(); CalculateRadial(); } + + protected override void OnDisable() + { + m_Tracker.Clear(); + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + } + public override void SetLayoutHorizontal() { } public override void SetLayoutVertical() { diff --git a/Runtime/Scripts/Layout/FlowLayoutGroup.cs b/Runtime/Scripts/Layout/FlowLayoutGroup.cs index 86eeb13..1aaccd9 100644 --- a/Runtime/Scripts/Layout/FlowLayoutGroup.cs +++ b/Runtime/Scripts/Layout/FlowLayoutGroup.cs @@ -422,5 +422,13 @@ namespace UnityEngine.UI.Extensions } return max; } - } + + protected override void OnDisable() + { + m_Tracker.Clear(); + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + } + + + } } \ No newline at end of file diff --git a/Runtime/Scripts/Layout/RadialLayout.cs b/Runtime/Scripts/Layout/RadialLayout.cs index e7b67f8..fb90cb5 100644 --- a/Runtime/Scripts/Layout/RadialLayout.cs +++ b/Runtime/Scripts/Layout/RadialLayout.cs @@ -55,6 +55,13 @@ namespace UnityEngine.UI.Extensions CalculateRadial(); } #endif + + protected override void OnDisable() + { + m_Tracker.Clear(); // key change - do not restore - false + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + } + void CalculateRadial() { m_Tracker.Clear(); diff --git a/Runtime/Scripts/Layout/TableLayoutGroup.cs b/Runtime/Scripts/Layout/TableLayoutGroup.cs index f5ca4f1..83ade4e 100644 --- a/Runtime/Scripts/Layout/TableLayoutGroup.cs +++ b/Runtime/Scripts/Layout/TableLayoutGroup.cs @@ -284,5 +284,11 @@ namespace UnityEngine.UI.Extensions // Set preferredRowHeights to null to free memory preferredRowHeights = null; } + + protected override void OnDisable() + { + m_Tracker.Clear(); // key change - do not restore - false + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + } } } \ No newline at end of file