Search Issue Tracker
By Design
Votes
0
Found in [Package]
2.2.2-preview
Issue ID
1249596
Regression
No
[DeviceSimulator] Screen class returns wrong measurements when using a custom editor
Repro steps:
1. Open QA attached project repro_1249596
2. Notice the width height and current resolution are reported correctly
3. Select "Screen" GameObject in the Hierarchy and click the "Show measurements" button in the Inspector
4. Observe the Console
Actual: Current resolution is correct but width and height are wrong
Reproducible with: 2019.3.16f1, 2020.1.0b12, 2020.2.0a15 - Device Simulator
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
- Reference to a deleted GameObject becomes "None" instead of "Missing" when the GameObject is restored with undo after entering and exiting Play Mode
- Size value in Particle System Curve's tab is highlighted with selection across all tab header
- Particle System Curve's Presets window has no visual indication of what preset is selected
- Blur shader doesn't work when the "Scene Color" Node is attached to the UI "Output" Node
- Particle System Curve presets can't be scrolled and some of them can't be selected if window is too narrow to fit them all
Resolution Note:
This is not Device Simulator specific behavior, you can reproduce the same thing with the regular Game view.
Screen.width/height will return the size of the editor window if called from editor IMGUI code. In this case it returns the size of the inspector window in which the button is. This is a quirk, but I can't really change it at this point, because god knows how much code relies on this quirk.
Notice, that even after the button is pressed the LogScreen.Update() continues printing correct values, so as long as you call width/height from a MonoBehavior event everything should work.