Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: jlloyd on July 13, 2016, 08:50:29 PM
-
Stack trace looks like this:
07-13 16:36:53.702 27259 27280 I Unity : NullReferenceException
07-13 16:36:53.702 27259 27280 I Unity : at UnityEngine.Transform.get_position () [0x00000] in <filename unknown>:0
07-13 16:36:53.702 27259 27280 I Unity : at UIAnchor.Update () [0x00000] in <filename unknown>:0
07-13 16:36:53.702 27259 27280 I Unity : at UIAnchor.ScreenSizeChanged () [0x00000] in <filename unknown>:0
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper delegate-invoke) UICamera/OnScreenResize:invoke_void__this__ ()
07-13 16:36:53.702 27259 27280 I Unity : at (wrapper
We believe is an issue inside UIAnchor.Update where mTrans is null. Adding null checks for mTrans seems to resolve the issue.
-
Both mTrans and the screen resize notification subscription are set in OnEnable which is guaranteed to be called before Update where you're running into the issue. I am not sure how you are getting it to happen at all. "mTrans" is always set first...
-
It only happens on device on Android (IL2CPP). No idea why, but like I said the null check fixed it up.
-
Because ScreenSizeChanged only be called on android. And on ios the screen size won't be changed unless you allow your app running on both portrait and landscape.
You may try to reproduce this issue in editor by change resolution in editor's Game view.