I'm having an issue where on my iPhone 13 (no other device seems to have this issue) where the safe area gets applied in one orientation but the minute you change orientation when the app is running, the safe area is inaccurate.
iPhone 13 reported:
A safe area after opening the app in portrait of: (X:0, Y:102, Width: 1170, Height: 2289)
A safe area after opening the app in landscape of: (X:141, Y:63, Width: 2250, Height: 1107)
A safe area after opening the app in portrait but rotating to landscape after load of: (X:0, Y:102, Width: 2532, Height: 927)
I'm not sure why the values of the safe area in landscape would be different from opening the app vs changing orientation when the app is running. Any ideas?
Code snippet:
public void ApplySafeArea(Rect pSafeArea) {
if (_trans == null) {
_trans = transform as RectTransform;
}
Vector2 anchorMin = pSafeArea.position;
Vector2 anchorMax = pSafeArea.position + pSafeArea.size;
anchorMin.x /= Screen.width;
anchorMin.y /= Screen.height;
anchorMax.x /= Screen.width;
anchorMax.y /= Screen.height;
_trans.anchorMin = anchorMin;
_trans.anchorMax = anchorMax;
}
Where pSafeArea is Screen.safeArea
Selecting any option will automatically load the page