Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Leopotam on June 22, 2015, 01:32:41 AM

Title: [FIX] Ngui dynamic fonts disappearing on scene save.
Post by: Leopotam on June 22, 2015, 01:32:41 AM
I waited 2 months for official fix, but it not happend. So, there is dirty fix for dynamic fonts issue:
*) non-intrusive - no changes to official ngui code.
*) auto apply on scene save, no need to tire user for pressing some menu items, just press "save scene" (ctrl+s / cmd+s) if font issue happens.
How to use - just import attached package, thats all.

UPD: For non-authorized users (who cant get access to attachment):
  1. using UnityEngine;
  2. using UnityEditor;
  3.  
  4. namespace LeopotamGroup.UnityEditor.NguiExtensions {
  5.     sealed class NguiFixer : global::UnityEditor.AssetModificationProcessor {
  6.         static string[] OnWillSaveAssets (string[] paths) {
  7.             foreach (var path in paths) {
  8.                 if (path == EditorApplication.currentScene) {
  9.                     FixLabels ();
  10.                 }
  11.             }
  12.  
  13.             return paths;
  14.         }
  15.  
  16.         static void FixLabels () {
  17.             foreach (var item in Object.FindObjectsOfType<UILabel> ()) {
  18.                 item.MarkAsChanged ();
  19.             }
  20.         }
  21.     }
  22. }
Title: Re: [FIX] Ngui dynamic fonts disappearing on scene save.
Post by: ArenMook on June 25, 2015, 06:04:01 PM
Thanks!