Author Topic: dynamic fonts disappearing in editor NGUI 3.9  (Read 22932 times)

mishaps

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
dynamic fonts disappearing in editor NGUI 3.9
« on: June 08, 2015, 03:22:06 AM »
Since Unity 5, everytime I save or alt-tab into unity all the UILabels with dynamic fonts disappear. This is cumbersome and frustrating to work with.

I understand from other forum posts and the changelog that this is suppose to be fixed. However, this bug still seems to be present in NGUI 3.9 with Unity 5.0.2p3.

Perhaps I'm missing some tick box or something?

jbausewein

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #1 on: June 08, 2015, 05:16:24 PM »
I have a similar problem, if I save the scene or save changes to a prefab, all the dynamic fonts will disappear in the game and scene view.   Running the scene will bring them back.

I was able to reproduce the issue in the "Example 7 - Scroll View" scene if I changed the description label to use unity font Arial.

I am using 5.0.2p4 (windows) and NGUI 3.9.0.

jbausewein

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #2 on: June 08, 2015, 05:39:41 PM »
I can also repro the issue on my mac running Unity 5.0.1f1.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #3 on: June 09, 2015, 01:24:49 AM »
Steps to repro?

I tried making a new scene with a dynamic font label, but alt tabbing back and forth didn't break anything.

jbausewein

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #4 on: June 09, 2015, 12:01:53 PM »
Alt tabbing doesn't break anything for me either.

Steps to reproduce:

1) open example scene 7.
2) change 'Label' in 'Window Panel' to use Unity Font Arial.
3) click File > Save Scene.
4) Label should disappear.
5) click Play.
6) Label should reappear.

Attached screenshot of issue.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #5 on: June 11, 2015, 06:18:06 AM »
Looks like Unity being Unity again.

When you hit save, it wipes the contents of the dynamic font's texture. There is no callback of any kind that occurs as far as I can tell. It just decides that it's not used, and wipes it. It's a Unity bug and should be reported to them as it works fine in Unity 4.

jbausewein

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #6 on: June 11, 2015, 12:25:36 PM »
Thanks again for your help on this!

mishaps

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #7 on: June 14, 2015, 01:18:48 AM »
Looks like Unity being Unity again.

When you hit save, it wipes the contents of the dynamic font's texture. There is no callback of any kind that occurs as far as I can tell. It just decides that it's not used, and wipes it. It's a Unity bug and should be reported to them as it works fine in Unity 4.

It's unfortunate nobody is able to find a work-around, unity bug or not. It's very difficult to work with and TBH really gets me thinking about switching to UGUI faster. Best products are the ones dev help us all work-around unity's shortcomings. Kinda the original spirit of NGUI, I felt anyways.

soulburner

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 22
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #8 on: June 21, 2015, 08:14:46 AM »
Have the save issue when saving a scene and waiting for a fix, it is impossible to work :(
Programmer at LazyBearGames.com
Making Punch Club and Graveyard Keeper

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #9 on: June 21, 2015, 02:08:30 PM »
@arenmook There is actually a Font.textureRebuilt UnityEvent on the Unity fonts now, not sure which version it came in.

@other guys For now you should be able to use a script like this:

  1. using UnityEngine;
  2. using UnityEditor;
  3.  
  4. public static class FontFix
  5. {
  6.  
  7.         [MenuItem("NGUI/Fix Fonts")]
  8.         static void FixFonts()
  9.         {
  10.                 var labels = GameObject.FindObjectsOfType<UILabel>();
  11.                 foreach (var label in labels)
  12.                 {
  13.                         label.Invalidate(false);
  14.                 }
  15.         }
  16. }

Which should make all the labels be recreated immediately. It's not pretty, but it should work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: dynamic fonts disappearing in editor NGUI 3.9
« Reply #10 on: June 21, 2015, 08:14:09 PM »
I know Nicki. NGUI uses it: line 1159 of UILabel.cs. It used to work fine in Unity 5 betas.