Unity3d release IOS9 application when the Chinese confusion code solution

  • 2020-05-12 06:14:49
  • OfStack

Simply put, the solution is to batch modify NGUI's label font and fix the Chinese garble caused by ios's deletion of arial

So how do we do that


static public void yaheifont()
  {
    uf = AssetDatabase.LoadAssetAtPath("Assets/yahei.prefab",typeof( UIFont)) as UIFont;
     UnityEngine.Object[] objs = Selection.GetFiltered (typeof(UnityEngine.Object), SelectionMode.DeepAssets);
     foreach (UnityEngine.Object _obj in objs)
     {
       string path = AssetDatabase.GetAssetPath(_obj);
       Debug.Log("objname:"+_obj.name);
       UnityEngine.Object[] arr = AssetDatabase.LoadAllAssetsAtPath(path);
       Debug.Log("PATH:"+path);
       foreach (Object j in arr)
       {
         if(j.GetType()==typeof(UILabel))
         {
           (j as UILabel).bitmapFont = uf;
           Debug.Log("dfdfd:" + j.name + ",tyep:" + j.GetType());
 
         }
 
       }
       EditorUtility.SetDirty(_obj);
     }
     AssetDatabase.SaveAssets();
  }


Related articles: