Unity 5 - Screen.width and Screen.height backwards for iOS 7

I’m using Unity 5.0.0p3, and it would appear that Screen.width and Screen.height values are backwards for devices using iOS 7, but are fine for devices using iOS 8.

Working devices:

iPhone 6 with OS version 8.1.3, width and height reads as 1920x1080
iPhone 5 with OS version 8.1.2, width and height reads as 1136x640

Non-working devices:

iPod Touch (5th gen) with OS version 7.0.4, width and height reads as 640x1136
iPhone 4 with OS version 7.0, width and height reads as 640x960

UPDATE: Turns out a blank Unity app built with the iPhone 5 using OS version 8.1.2 also has backwards width and height so it may not have to do with OS version. This is strange, as it reports the dimensions properly for our actual game but not for a blank Unity app. I’ve double-checked and I’m not getting the properties mixed up or backwards.

Debug.Log("Width: " + Screen.width);
Debug.Log("Height: " + Screen.height);

That’s all I’m using in both actual project and blank app. I’ve submitted a bug report to Unity.

@skaarjslayer Could you post the bug number here?

@povilas Sure, it’s Case 685555

Did this ever get fixed?

I received an email a little over a week ago from Unity that said this:

“This issue should be now fixed and I can no longer reproduce it on the latest Unity 5.2 build (5.2.3f1) so I’ll be closing this in case. Be sure to reply to this email if you can still reproduce this.”

This issue is still happening in Unity 5.3.1!

I’m also getting it on Unity 5.3.4p2 with an iPhone 4 with iOS 7.0 (11A465)

P.S. I also had something similar on an old iPad 2 with iOS 6.x but I wasn’t worried about it since we’re dropping iOS 6.x devices from our applications.

I’m pretty sure this was more of an issue with the particular OS version of iOS. I had to manually deal with this for years in native code. The main issue was that when iOS 7 or earlier started up it was always in a portrait orientation regardless of whether your app was actually landscape only, the values would then change later on after your app delegate code would set the correct values to force landscape. I’m assuming that these values are just passed through to Unity.

The simplest fix is to just read and rewire the values so that they’re always correct regardless the point in which the OS reports the incorrect values or not:
float w = Screen.width;
float h = Screen.height;
if ( w < h ){
w = Screen.height;
h = Screen.width;
}

Thanks for the reply. I ended up doing something similar but only for ios versions < 8 … It would be nice that Unity could solve this though.