- Edited
dtappe Yes, this is what I actually added:
// Detects if children have been resized since last frame // or if this container have been resized // or if any children have been activated or deactivated float newFlexibleSpace = CalculateSpaceBetweenItemsY(true, false, out float totalFlexibleSpaceBetweenItemsPercent, out float minContainerHeightNeeded);
newFlexibleSpace += CalculateSpaceBetweenItemsX(true, false,
out totalFlexibleSpaceBetweenItemsPercent,
out minContainerHeightNeeded);
float newContainerSize = container.GetHeight() + container.GetWidth();
// detect if active children count has changed since last frame
List<RectTransform> activeChildren = GetChildrenFirstDepth(container);
bool activeChildrenCountChanged = activeChildren.Count != activeChildCount;
if (lastRefreshItemsSpace != newFlexibleSpace ||
lastRefreshContainerSize != newContainerSize ||
activeChildrenCountChanged ||
needsLateResize)
{
Resize(activeChildrenCountChanged || needsLateResize);
lastRefreshItemsSpace = newFlexibleSpace;
lastRefreshContainerSize = newContainerSize;
}