A game about forced loneliness, made by TACStudios
at master 30 lines 1.2 kB view raw
1using UnityEngine; 2using UnityEditor; 3using UnityEditor.Build; 4using UnityEditor.Build.Reporting; 5 6namespace TMPro 7{ 8 public class TMP_PreBuildProcessor : IPreprocessBuildWithReport 9 { 10 public int callbackOrder { get { return 0; } } 11 12 public void OnPreprocessBuild(BuildReport report) 13 { 14 // Find all font assets in the project 15 string searchPattern = "t:TMP_FontAsset"; 16 string[] fontAssetGUIDs = AssetDatabase.FindAssets(searchPattern); 17 18 for (int i = 0; i < fontAssetGUIDs.Length; i++) 19 { 20 string fontAssetPath = AssetDatabase.GUIDToAssetPath(fontAssetGUIDs[i]); 21 TMP_FontAsset fontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(fontAssetPath); 22 23 if (fontAsset != null && (fontAsset.atlasPopulationMode == AtlasPopulationMode.Dynamic || fontAsset.atlasPopulationMode == AtlasPopulationMode.DynamicOS) && fontAsset.clearDynamicDataOnBuild && fontAsset.atlasTexture.width != 0) 24 { 25 fontAsset.ClearCharacterAndGlyphTablesInternal(); 26 } 27 } 28 } 29 } 30}