Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: schneidb on May 29, 2014, 03:43:41 PM
-
On iOS, I'm getting NullReferenceExceptions when I attempt to do UIButton.GetScreenRect()
It looks like UICamera.currentCamera is null on line 10 of NGUIExtensions.cs
I know I can just check for null, but if you have any suggestions for how I should/could make a real fix, that'd be great.
This does not happen in the Unity Editor.
-
What's NGUIExtensions? There is no such file in NGUI. There is NGUIEditorExtensions, and line 10 is just a comment before the static class itself.
-
Sorry, this was my mistake. NGUIExtensions is my colleague's class. I was just too tired at the time to notice. Having said that, we still can't figure out why UICamera.currentCamera is null in an Update method only in iOS.
-
All 'current' references in NGUI are valid only during specific callbacks. In case of UICamera.currentCamera it's set for NGUI's events such as OnClick, OnPress, OnHover, etc. It's only valid during those events.
-
Thanks for the information.