Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Disastercake on March 12, 2013, 06:03:45 PM

Title: NullReferenceException UISprite.OnFill
Post by: Disastercake on March 12, 2013, 06:03:45 PM
I updated today and I am now getting this error:
  1. NullReferenceException: Object reference not set to an instance of an object
  2. UISprite.OnFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/NGUI/Scripts/UI/UISprite.cs:353)
  3. UIWidget.UpdateGeometry (UnityEngine.Matrix4x4& worldToPanel, Boolean parentMoved, Boolean generateNormals) (at Assets/NGUI/Scripts/Internal/UIWidget.cs:431)
  4. UIPanel.UpdateWidgets () (at Assets/NGUI/Scripts/UI/UIPanel.cs:848)
  5. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:983)
  6.  

That points to this line of code in UISprite.cs (Line 353 in Monodevelop):
  1. colF.a *= mPanel.alpha;
  2.  

I was not getting this error before, and I have changed nothing in the project since updating.  what is causing this?
Title: Re: NullReferenceException UISprite.OnFill
Post by: ArenMook on March 13, 2013, 01:07:59 AM
Likely not following upgrade instructions that involve creating a new scene prior to updating.
Title: Re: NullReferenceException UISprite.OnFill
Post by: cbartlett on April 26, 2013, 10:35:24 AM
I JUST started having this problem and I haven't upgraded and have been using this for ... several months.  This morning running the same code, it started happening.  Doesn't make sense why....

I was hoping for anyone to comment on possible causes before I delve in and try to track it down...
Title: Re: NullReferenceException UISprite.OnFill
Post by: cbartlett on April 26, 2013, 11:57:55 AM
Interestingly enough it went away when I renamed the sprite.  I had 4 the same name (ctrl D) and was trying to figure out which one was causing the problem.  After renaming, the error stopped....
Title: Re: NullReferenceException UISprite.OnFill
Post by: ArenMook on April 26, 2013, 12:36:23 PM
I added a check for this in 2.6.0 seeing as people keep running into it and I've yet to reproduce it. Better be on the safe side.
Title: Re: NullReferenceException UISprite.OnFill
Post by: cbartlett on April 26, 2013, 02:29:44 PM
Cool, I wish I could provide more info, but duplicating isn't the trigger either.  I dup all the time and up until today I haven't had an issue.
Title: Re: NullReferenceException UISprite.OnFill
Post by: adam718 on April 26, 2013, 10:05:41 PM
Cool, I wish I could provide more info, but duplicating isn't the trigger either.  I dup all the time and up until today I haven't had an issue.

Hi! Aren,
I faced that problem with old project (if new project with creating new ui, no problem.)
And I fix that error with following step.
1. remove UIPanel component.
2. add it again.
I wondered that problem was because the order of component execution?
Title: Re: NullReferenceException UISprite.OnFill
Post by: ArenMook on April 26, 2013, 10:38:47 PM
Might be. Hopefully the check I added to 2.6.0 will fix it.
Title: Re: NullReferenceException UISprite.OnFill
Post by: cbartlett on May 14, 2013, 04:48:23 PM
I located at least one instance where this occurs.  I have a table which is inactive.  Reposition was being called on it prior to it being activated.  The reposition was setting the panel, but during the Start() the panel was being nulled and because the panel was already repositioned, it wasn't called again.

Hope some of this info is helpful
Title: Re: NullReferenceException UISprite.OnFill
Post by: galuodo on May 14, 2013, 08:57:56 PM
I have the same problem in 2.5.1
Title: Re: NullReferenceException UISprite.OnFill
Post by: ArenMook on May 15, 2013, 01:29:40 AM
Then update NGUI, because this has already been fixed.