- Home /
Updating All TextMesh Pro FontAssets with editorscript
I have a lot of fonts in my project and using TextMesh Pro (Build-In, 1.3.0). For all of the FontAssets I use "Character Set: Character from File" and they are sharing the same textfile.
However if I change the characters in that textfile, I have to do the following for all of the FontAssets:
1) Select the TMP_FontAsset-asset in Project-view
2) Hit the "Update Atlas Texture"-button in the Inspector-view
3) Hit the Generate Font Atlas in the Font Creator-view
4) Wait for around 10 seconds
5) Hit the Save button in the same view
This is time consuming and stupid, so I'm wondering, if I could do a clever editorscript batch, that does all of this for me. I have the following so far:
 #if UNITY_EDITOR
 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEditor;
 using TMPro;
 
 public class UnityEditorTools
 {
     [MenuItem ("Tools/Update All TextMesh Pro Atlas Textures")]
     public static void UpdateAllTextMeshProAtlasTextures()
     {
         var tmp_FontAssets = new List<TMP_FontAsset>();
         foreach (string guid in AssetDatabase.FindAssets ("t:TMP_FontAsset"))
         {
             string path = AssetDatabase.GUIDToAssetPath (guid);
             tmp_FontAssets.Add (AssetDatabase.LoadAssetAtPath<TMP_FontAsset> (path));
         }
         foreach (var tmp_FontAsset in tmp_FontAssets)
         {
             //Do 1-5 here...
         }
 
         AssetDatabase.SaveAssets();
         AssetDatabase.Refresh();
         Debug.Log ("Success.");
     }
 }
 #endif
But I don't know how to get to do the 1-5 on the tmp_FontAsset...
Any tips or helps would be most valuable! Thanks! :-)
Hi!, just wondering if you ever found a solution for this. I too would like to know if there's a way to do this via script.
Unfortunately not. Still doing it manually :-( If you figure out anything please post!
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                