Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Wisteso on September 28, 2014, 05:38:13 PM

Title: PSA: iOS 8 + Unity 4.5 + Screen dimensions
Post by: Wisteso on September 28, 2014, 05:38:13 PM
Just a PSA to maybe save some people a lot of wasted effort...

iOS 8 broke the behavior of Screen.width / Screen.height when reading the value before the first scene had finished loading entirely. So any code that used those values in an OnEnable or Awake handler would return weird values. Unity 4.5.4 patch notes were far too vague and had said...

Quote
iOS: Fixed handling of resolution preset in Player Settings.
iOS: Fixed startup orientation handling on iOS 8.

However, they failed to mention specifically that Unity 4.5.4 also fixed the problem with Screen.width / Screen.height giving incorrect values in Awake/OnEnable

TL;DR: Use Unity 4.5.4 if you are getting weird values for screen dimensions in your initialization code. Unity 4.6 beta 17 does not yet have these fixes, AFAIK.
Title: Re: PSA: iOS 8 + Unity 4.5 + Screen dimensions
Post by: kid on November 17, 2014, 04:52:36 AM
thx for sharing!
Title: Re: PSA: iOS 8 + Unity 4.5 + Screen dimensions
Post by: huixiong on November 27, 2014, 03:00:01 AM
Just a PSA to maybe save some people a lot of wasted effort...

iOS 8 broke the behavior of Screen.width / Screen.height when reading the value before the first scene had finished loading entirely. So any code that used those values in an OnEnable or Awake handler would return weird values. Unity 4.5.4 patch notes were far too vague and had said...

However, they failed to mention specifically that Unity 4.5.4 also fixed the problem with Screen.width / Screen.height giving incorrect values in Awake/OnEnable

TL;DR: Use Unity 4.5.4 if you are getting weird values for screen dimensions in your initialization code. Unity 4.6 beta 17 does not yet have these fixes, AFAIK.
谢谢