Display.systemWidth returns "Game View" width in Editor

Hi all,

just wanted to ask if you could check what this code returns in your editors:

Debug.Log(Display.main.systemWidth);

According to the docs it should return the “Horizontal native display resolution.”.
However in the Editor it seems to return the size of the game view.

Tested in
Unity 2020.2.30f1
Unity 2021.3.26f1
Unity 2022.1.16f1

Is this by design?
I expected this to always return the actual native display resolution (as the name suggests).

Thank you

Yeah in the editor (Unity 2021.3) it returned the game view width and not the display width.

It seems Screen.currentResolution.width will show the display width.

btw - very nice motorbike game!.

Thanks for testing. I am reluctant to use Screen.currentResolution as (If I am not mistaken) that can be set via the resolution api and I would really need a reliable way to get the native resolution no matter what the settings are. “Display.main.systemWidth” works fine in builds btw., it’s just the Editor that is tripping me up.

I might have to fall back on some #ifdef-ing but I wonder, shouldn’t there be an API for this that works in editor and builds?

Thank you :_)