Screen.width/height have different values in Awake and Start on Retina Mac screens

When running in the editor on Mac Retina screens, Screen.width and Screen.height report different values when called from Awake and Start (points in Awake, pixels in Start). Screen.dpi is reported as the same value. The following script when dropped on an empty object in an empty scene with a default editor layout in 5.4.0b3 reports the following values:

using UnityEngine;
public class ScreenSizeTest : MonoBehaviour {
    void Awake() {
        Debug.Log("AWAKE: SCREEN SIZE IS " + Screen.width + ", " + Screen.height + "(" + Screen.dpi + ")");
    }
    void Start () {
        Debug.Log("START: SCREEN SIZE IS " + Screen.width + ", " + Screen.height + "(" + Screen.dpi + ")");   
    }   
}


2488048–171602–ScreenSizeTest.unitypackage (4.87 KB)

1 Like

That sounds like a bug. Can you submit a case using the bug reporter?

This is hitting me right now on 5.4.0b10. What is the correct behavior? I assume that Screen.height is supposed to be half the actual height in pixels so that it matches Screen.dpi? Is there any way to detect a retina screen so I can divide Screen.height in half manually until the bug gets fixed?

1 Like