Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: getluky on March 20, 2013, 01:43:42 PM

Title: NullReferenceException inside UILabel.OnFill
Post by: getluky on March 20, 2013, 01:43:42 PM
After updating to 2.3.6 and Unity 4.1 (followed upgrade instructions), I'm getting this error with a specific button's label in a scene:

  1. NullReferenceException: Object reference not set to an instance of an object
  2. UILabel.OnFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/Plugins/NGUI/UI/UILabel.cs:605)
  3. UIWidget.UpdateGeometry (UnityEngine.Matrix4x4& worldToPanel, Boolean parentMoved, Boolean generateNormals) (at Assets/Plugins/NGUI/Internal/UIWidget.cs:431)
  4. UIPanel.UpdateWidgets () (at Assets/Plugins/NGUI/UI/UIPanel.cs:848)
  5.  

It happens on the first frame that the button is visible because mPanel is null, and seems to keep happening when the button's panel is hidden and re-shown. I tried inserting this beforehand:

  1. if (mPanel == null) CreatePanel();
  2.  

... but it doesn't help - CreatePanel isn't creating the panel, and mPanel is remaining null. Changing UIPanel.UpdateWidgets to check NGUITools.GetActive (w.gameObject) before UpdateGeometry seems to prevent the issue, but is probably overkill. Any ideas?
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: ArenMook on March 20, 2013, 02:12:09 PM
Wait for 2.5.0 then see if it happens again.
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: AlexGav on April 25, 2013, 10:11:29 AM
Hi, I have just updated to version 2.5.1 from 2.2.7 and I am still getting the null reference exception

NullReferenceException: Object reference not set to an instance of an object
UILabel.OnFill (.BetterList`1 verts, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/NGUI/Scripts/UI/UILabel.cs:635)
UIWidget.UpdateGeometry (UnityEngine.Matrix4x4& worldToPanel, Boolean parentMoved, Boolean generateNormals) (at Assets/NGUI/Scripts/Internal/UIWidget.cs:497)
UIPanel.UpdateWidgets () (at Assets/NGUI/Scripts/UI/UIPanel.cs:848)
UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:983)
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: ArenMook on April 25, 2013, 12:55:32 PM
Every time I've heard of this error it was because the person doing the upgrade didn't follow the proper instructions in the readme file that involved creating a new scene first.
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: Clicker on May 21, 2013, 07:29:24 AM
Hi all. I can't find a good way to deal with this annoying exception which always happens when I switch a reference in my atlas of reference type, for instance switching HD to SD. I have never caught this exception in HD but always in SD. HD atlas is a default for my atlas of reference type. For the first time I found a solution to divide my panel into two panels with the same content (actually it rises draw calls... but solves the problem). Moreover, I think the problem could be in the pixel size attribute in atlas. Any ideas?
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: ArenMook on May 21, 2013, 12:56:00 PM
What version of NGUI are you using? 2.6.1 had extra checks to make sure that this never happens, even if something does go wrong.
Title: Re: NullReferenceException inside UILabel.OnFill
Post by: Clicker on May 22, 2013, 02:23:00 AM
I am using a non pro version of NGUI. I forgot to check out the latest version of it since 2.5.1 where the problem appears. But, after updating to 2.6.1e which is current non pro now, it did solve the problem. Thank you and sorry for my inattention. :)