Author Topic: Bug: NullReferenceException after LoadLevelAdditive on Android  (Read 8739 times)

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Bug: NullReferenceException after LoadLevelAdditive on Android
« on: February 27, 2013, 12:49:58 PM »
I found a bug that does not appear in the editor or Windows, only in Android. I change levels in my game by removing the objects that belong to the current level and calling LoadLevelAdditive. I do not remove/modify the NGUI root object. Still, after all this happens (and it's pretty slow on my phone unfortunately) I start getting these exceptions:

I/Unity   (12974):
I/Unity   (12974): (Filename: C Line: 0)
I/Unity   (12974):
I/Unity   (12974): NullReferenceException
I/Unity   (12974):   at UIPanel.UpdateDrawcalls () [0x00132] in C:\Users\maul\Desktop\mook_trunk\Assets\NGUI\Scripts\UI\UIPanel.cs:873
I/Unity   (12974):   at UIPanel.LateUpdate () [0x00115] in C:\Users\maul\Desktop\mook_trunk\Assets\NGUI\Scripts\UI\UIPanel.cs:969

Hope this is all the info you need to fix it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug: NullReferenceException after LoadLevelAdditive on Android
« Reply #1 on: February 27, 2013, 08:54:46 PM »
Is stripping enabled? That usually causes issues.

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Bug: NullReferenceException after LoadLevelAdditive on Android
« Reply #2 on: February 28, 2013, 05:42:37 AM »
Looking at the reported lines I'm not sure what stripping would have to do with this, but it's not enabled anyway.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Bug: NullReferenceException after LoadLevelAdditive on Android
« Reply #3 on: February 28, 2013, 08:37:14 AM »
I would imagine that you've destroyed some objects that it used. Maybe the UIDrawCalls are still referenced in the UIPanel and you destroy them if you're only saving the things you expect to need.Try to not destroy UIDrawCall objects and see if it works.

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Bug: NullReferenceException after LoadLevelAdditive on Android
« Reply #4 on: February 28, 2013, 08:43:06 AM »
Thanks for the tip, it is possible, altough I've checked my code a few times.
Anyway, since then I've moved on to a different loading solution, so this is not an immediate issue right now. I just thought it was an NGUI bug.