Author Topic: NullReferenceException UISprite.OnFill  (Read 13945 times)

Disastercake

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 87
  • www.disastercake.com
    • View Profile
    • Disastercake
NullReferenceException UISprite.OnFill
« 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?
Creator of Soul Saga.
http://www.disastercake.com

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #1 on: March 13, 2013, 01:07:59 AM »
Likely not following upgrade instructions that involve creating a new scene prior to updating.

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #2 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...

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #3 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....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #4 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.

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #5 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.

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #6 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #7 on: April 26, 2013, 10:38:47 PM »
Might be. Hopefully the check I added to 2.6.0 will fix it.

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #8 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

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #9 on: May 14, 2013, 08:57:56 PM »
I have the same problem in 2.5.1

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NullReferenceException UISprite.OnFill
« Reply #10 on: May 15, 2013, 01:29:40 AM »
Then update NGUI, because this has already been fixed.