Author Topic: NGUI causes crash on iPad when built with "script debugging"  (Read 9131 times)

n8

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
I started having a bug in my code the other day that only appeared when playing my game on my iPad. When I tried to create a build with the "script debugging" option checked, the app crashes as soon as NGUI is is loaded.  I have verified this by completely disabling the UI Root object, and running the build again. Without ngui enabled the app runs fine (although you can't do anything of course).  I started going through and re-enabling components one by one.  I could get the app to run fine nothing but one sliced sprite on the screen, however as soon as you touch the screen the app crashes.  The app starts crashing as soon as I enable just one button in the scene. xcode reports a null reference exception, but no mention of what file or line.  When I try to connect the debugger, it just loses the connection and doesn't say where the error occurred.

I am not doing anything crazy with my ui so I am a bit confused.  Everything works great when the "script debugging" option is left unchecked.  Any ideas?

n8

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #1 on: June 07, 2012, 10:34:27 PM »
Ok so I was finally able to get the debugger to connect to the ipad quick enough to report the error.  Seems to have something to do with bmfont:

the exception is a nullReference and is being thrown on line 142 of bmfont.cs - mDict.Add(bmg.index, bmg);
this is in the "getglyph" function

Anybody know what is going on here?  I have checked my font and everything seems to be ok.  I am using a reference font pointed to an HD font.  At this point I am not doing any font switching.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #2 on: June 08, 2012, 02:15:14 AM »
And this happens only with script debugging turned on?

n8

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #3 on: June 08, 2012, 03:37:37 PM »
yes it is only happening when I check the "script debugging" and then build to the device.  If I run the game in the editor or on the device without "script debugging" checked, then it runs just fine.  There is a real possibility that this is some sort of Unity bug in that this manifesting in other ways as well.  I started this thread over in the Unity forums before I mentioned it here.  http://forum.unity3d.com/threads/138409-quot-Script-Debugging-quot-option-causes-app-to-crash-on-device

This could be something wrong with my project or with source control or something.  I am still looking into it.  I will report back here when I find out more

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #4 on: June 13, 2012, 03:02:51 PM »
Same issue for me, running with Unity 3.5.2 and the latest version of NGUI.
I'll stay tuned to this thread, if anyone find a solution.  :D

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #5 on: August 27, 2012, 10:22:48 AM »
Up !
Still the same problem here.
There is some log, it might be useful.

Quote
Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required.
  at UIWidget.set_color (Color value) [0x00000] in [...]/Assets/NGUI/Scripts/Internal/UIWidget.cs:53

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #6 on: August 27, 2012, 12:31:32 PM »
It errors out on:
  1. if (!mColor.Equals(value)) { mColor = value; mChanged = true; }
?

That I simply have no idea about. There is no null exception possible here. Null exception on what? mColor is a struct and mChanged is a boolean. There are no classes here, so no "nulls" even possible. I'm afraid that this is a question for Unity.

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #7 on: August 27, 2012, 01:02:30 PM »
And this error appears only when Script debugging is checked.
Maybe the object trying to set the color of some widget, which is null, maybe, but why only in script debugging????

I would like to know the difference between a compilation with and without Script Debugging...

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #8 on: August 27, 2012, 01:32:00 PM »
Someone told me that in Script Debugging maybe all exceptions are handled (as a different level of exception), this could explain why it crashes.

n0mad

  • Guest
Re: NGUI causes crash on iPad when built with "script debugging"
« Reply #9 on: November 18, 2012, 09:19:43 AM »
Same problem here. Crashes at startup with Script Debugging (title screen is ultra basic, only a 3D model and NGUI UI).
Doesn't crash without.