From 6768bb86d006dcc14fe555ff265231829221cbf7 Mon Sep 17 00:00:00 2001 From: Vasily Kuznetsov <31756050+RunoLight@users.noreply.github.com> Date: Sat, 19 Sep 2026 18:54:48 +0400 Subject: [PATCH] Unity 6.5 support - update to use new Unity API with conditional compilation to preserve back compability. --- Runtime/Scripts/Layout/FlowLayoutGroup.cs | 9 +++++---- Runtime/Scripts/Layout/TableLayoutGroup.cs | 9 ++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Runtime/Scripts/Layout/FlowLayoutGroup.cs b/Runtime/Scripts/Layout/FlowLayoutGroup.cs index 05e679e..b371c52 100644 --- a/Runtime/Scripts/Layout/FlowLayoutGroup.cs +++ b/Runtime/Scripts/Layout/FlowLayoutGroup.cs @@ -45,7 +45,8 @@ public override void CalculateLayoutInputHorizontal() base.CalculateLayoutInputHorizontal(); var minWidth = GetGreatestMinimumChildWidth() + padding.left + padding.right; #if UNITY_6000_6_OR_NEWER - SetLayoutInputForAxis(minWidth, -1, -1, 0, 0); + // Unity 6.6+: (min, max, preferred, flexible, axis) + SetLayoutInputForAxis(minWidth, LayoutUtility.DefaultMaxSize, -1, -1, 0); #else SetLayoutInputForAxis(minWidth, -1, -1, 0); #endif @@ -78,10 +79,10 @@ public override void CalculateLayoutInputVertical() base.CalculateLayoutInputHorizontal(); var minHeight = GetGreatestMinimumChildHeigth() + padding.bottom + padding.top; #if UNITY_6000_6_OR_NEWER - SetLayoutInputForAxis(minHeight, -1, -1, 1, 1); + SetLayoutInputForAxis(minHeight, LayoutUtility.DefaultMaxSize, -1, -1, 1); #else SetLayoutInputForAxis(minHeight, -1, -1, 1); -#endif +#endif } } @@ -283,7 +284,7 @@ public float SetLayout(int axis, bool layoutInput) if (layoutInput) { #if UNITY_6000_6_OR_NEWER - SetLayoutInputForAxis(offset, offset, -1, axis, 0); + SetLayoutInputForAxis(offset, LayoutUtility.DefaultMaxSize, offset, -1, axis); #else SetLayoutInputForAxis(offset, offset, -1, axis); #endif diff --git a/Runtime/Scripts/Layout/TableLayoutGroup.cs b/Runtime/Scripts/Layout/TableLayoutGroup.cs index 9e53a74..e3fc7b4 100644 --- a/Runtime/Scripts/Layout/TableLayoutGroup.cs +++ b/Runtime/Scripts/Layout/TableLayoutGroup.cs @@ -120,8 +120,10 @@ public override void CalculateLayoutInputHorizontal() } horizontalSize -= columnSpacing; + #if UNITY_6000_6_OR_NEWER - SetLayoutInputForAxis(horizontalSize, horizontalSize, 0, 0, 0); + // Unity 6.6+: (min, max, preferred, flexible, axis) — fixed column width, so max == preferred + SetLayoutInputForAxis(horizontalSize, horizontalSize, horizontalSize, 0, 0); #else SetLayoutInputForAxis(horizontalSize, horizontalSize, 0, 0); #endif @@ -187,10 +189,11 @@ public override void CalculateLayoutInputVertical() totalPreferredHeight = Mathf.Max(totalMinHeight, totalPreferredHeight); #if UNITY_6000_6_OR_NEWER - SetLayoutInputForAxis(totalMinHeight, totalPreferredHeight, 1, 1, 1); + // flexible=1 → can grow, so max is unconstrained + SetLayoutInputForAxis(totalMinHeight, LayoutUtility.DefaultMaxSize, totalPreferredHeight, 1, 1); #else SetLayoutInputForAxis(totalMinHeight, totalPreferredHeight, 1, 1); -#endif +#endif } public override void SetLayoutHorizontal()