Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.46f1
2022.3.54f1
6000.0.30f1
6000.1.0a7
6000.2.0a1
Issue ID
UUM-90581
Regression
No
Screen.safeArea returns wrong values when called in Awake upon loading another Scene
Reproduction steps:
1. Open the attached “Test.zip” project
2. Open the “Assets/Scenes/SampleScene“ Scene
3. Enter Play Mode
4. Observe the “awake area=…“ log resolution values in the Console
5. In the Game View window, press the button in the center
6. Observe the new “awake area=…” log values
7. Compare the step 4 and step 6 values
Expected result: The values match and are the same as the Aspect Ratio of the Game View
Actual result: The values in step 7 are different and are dependent on the size of the Game View window
Reproducible with: 2021.3.46f1, 2022.3.54f1, 6000.0.30f1, 6000.1.0a7
Reproducible on: macOS Sequoia 15.1.1
Not reproducible on: Windows 11, Ubuntu 24.04
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Resolution Note:
The getSafeArea method gives incorrect values if called from Awake() during a scene load. This happens because Awake() runs before the new scene is completely ready and platform details are available.This isn't a bug. Awake() is meant for a script's own initial setup and is simply too early to get reliable data that depends on the fully loaded scene.
To get the correct values, call getSafeArea in Start() or a later method, when the scene is guaranteed to be fully initialised.