Author Topic: UILabels breaking  (Read 7404 times)

Cwal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
UILabels breaking
« on: August 31, 2015, 06:09:43 PM »
I have a project that I upgraded to NGUI 3.9.2, and every time I change the font size on a label that is set to shrink content, I get a series of error messages that "Destroying GameObjects immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead." and the text gets stuck on the screen.  It seems to happen most consistently when the font size becomes greater than the height of the box.

I also get "NullReferenceException: Object reference not set to an instance of an object
UIDrawCall.CreateMaterial () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:260)
UIDrawCall.RebuildMaterial () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:348)
UIDrawCall.UpdateMaterials () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:368)
UIDrawCall.OnWillRenderObject () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:568)
UnityEditor.DockArea:OnGUI()"

when playing the scene after one of these errors occurs.
This is preventing me from rebuilding my UI, any help would be appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabels breaking
« Reply #1 on: September 06, 2015, 05:03:01 PM »
Do you have something being called from within a physics or animation callback? That's what the error is pointing to. The null exception is likely caused by the first error in your case.

dxball

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabels breaking
« Reply #2 on: September 07, 2015, 07:55:09 PM »
Hi, I'm facing the same problem.

I'm using Unity 5.1.3f1 & NGUI 3.9.2

I made a repo video to show this issue

https://youtu.be/pACjnQYzic8

siavash

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UILabels breaking
« Reply #3 on: September 09, 2015, 11:10:16 PM »
We also faced the same issue in our project (Unity 5.1.3f1 , NGUI 3.9.2) . The text UIlabel crashes ,sometimes doesn't show the text at all so We had to turn it off and on by code.Another problem that we are facing is that the UI label position & size changes suddendly during the game  .
https://www.dropbox.com/s/ene1lvxtpa2ye27/Screenshot%202015-09-10%2011.35.50.png?dl=0

sean

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UILabels breaking
« Reply #4 on: September 12, 2015, 01:21:28 AM »
Yes, I got this problem too. Is this a bug of version 3.9.2?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabels breaking
« Reply #5 on: September 13, 2015, 06:14:02 AM »
Can one of you create a repro case for me to look at that exhibits this issue? I don't have this happening on my end so I can't fix it properly. However you can just add null checks on line 260 and 287:
  1. mClipCount = (panel != null) ? panel.clipCount : 0;
  1. if (panel != null && panel.clipping == Clipping.TextureMask)

dxball

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UILabels breaking
« Reply #6 on: September 13, 2015, 07:42:03 PM »
Can one of you create a repro case for me to look at that exhibits this issue? I don't have this happening on my end so I can't fix it properly. However you can just add null checks on line 260 and 287:
  1. mClipCount = (panel != null) ? panel.clipCount : 0;
  1. if (panel != null && panel.clipping == Clipping.TextureMask)
Hi
The vidoe I made is just a new project created by Unity 5.1.3
import NGUI from Assets/Custom Package/ -> Find NGUI Package in Path "C:\Users\[login account]\AppData\Roaming\Unity\Asset Store-5.x\Tasharen Entertainment\Editor ExtensionsGUI\"

If the UILable use Unity Font and change the font size in unity inspector quickly, the issue will happen


-- edit

I just add the fixed code to the repo project, but this issue still happen  :-X
« Last Edit: September 13, 2015, 07:48:52 PM by dxball »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabels breaking
« Reply #7 on: September 20, 2015, 01:22:23 AM »
Add another early exit to UpdateMaterials() function in UIDrawCall.cs, line 364:
  1.         void UpdateMaterials ()
  2.         {
  3.                 if (panel == null) return; // <-- here
  4.  
  5.                 // If clipping should be used, we need to find a replacement shader
  6. ...

MrNoobin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UILabels breaking
« Reply #8 on: September 22, 2015, 08:13:43 PM »
Add another early exit to UpdateMaterials() function in UIDrawCall.cs, line 364:
  1.         void UpdateMaterials ()
  2.         {
  3.                 if (panel == null) return; // <-- here
  4.  
  5.                 // If clipping should be used, we need to find a replacement shader
  6. ...

Ran into the same issue. All your posts on this thread fixed it for me. Thank you!

shaunpeoples

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UILabels breaking
« Reply #9 on: September 23, 2015, 10:06:27 AM »
Saw this issue, changed code, then had the editor complain that Destroy can't be used in Editor. Created all manner of trouble with dynamic fonts.

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: UILabels breaking
« Reply #10 on: September 23, 2015, 01:04:57 PM »
Following. I am seeing this same issue.

dafunker

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
« Last Edit: September 28, 2015, 07:36:23 AM by dafunker »