For clarity, the background for ScrollRect and Content was colored.
white is scroll
green is content
in the popup near the title there is debugging text
Cbounds - bound content of the scroll object.
and by some magic he is x size miniature. Although, as you can see from the screenshots, it is of normal size (green)
There is a canvas scaler on the top canvas. The child Content object has a ContentSizeFilter with Preferred Size for Hor and Vert
At the top of the Popup next to the title there is a debug text, where VBounds is View Bounds, and CBounds is content Bounds. I took the code from ScrollRect.cs
Code from Unity ScrollRect.cs:
protected void UpdateBounds()
{
m_ViewBounds = new Bounds(viewRect.rect.center, viewRect.rect.size);
m_ContentBounds = GetBounds();
}
private Bounds GetBounds()
{
if (m_Content == null)
return new Bounds();
m_Content.GetWorldCorners(m_Corners);
var viewWorldToLocalMatrix = viewRect.worldToLocalMatrix;
return InternalGetBounds(m_Corners, ref viewWorldToLocalMatrix);
}
internal static Bounds InternalGetBounds(Vector3[] corners, ref Matrix4x4 viewWorldToLocalMatrix)
{
var vMin = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
var vMax = new Vector3(float.MinValue, float.MinValue, float.MinValue);
for (int j = 0; j < 4; j++)
{
Vector3 v = viewWorldToLocalMatrix.MultiplyPoint3x4(corners[j]);
vMin = Vector3.Min(v, vMin);
vMax = Vector3.Max(v, vMax);
}
var bounds = new Bounds(vMin, Vector3.zero);
bounds.Encapsulate(vMax);
return bounds;
}
(1 pic.) (correct) - unity, android, ios
(2 pic.)(incorrect) - uwp
On the previous version of Unity it was ok
Was 2020.3.33f1
Became 2022.3.19f