12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using UnityEngine;
- using UnityEditor;
- namespace TMPro.EditorUtilities
- {
-
-
-
-
- internal class TMPro_TexturePostProcessor : AssetPostprocessor
- {
- private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
- {
- foreach (var asset in importedAssets)
- {
-
- if (asset.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase) == false)
- continue;
- Type assetType = AssetDatabase.GetMainAssetTypeAtPath(asset);
- if (assetType == typeof(TMP_FontAsset))
- {
- TMP_FontAsset fontAsset = AssetDatabase.LoadAssetAtPath(asset, typeof(TMP_FontAsset)) as TMP_FontAsset;
-
- if (fontAsset != null && fontAsset.m_CharacterLookupDictionary != null)
- TMP_EditorResourceManager.RegisterFontAssetForDefinitionRefresh(fontAsset);
- }
- if (assetType == typeof(Texture2D))
- {
- Texture2D tex = AssetDatabase.LoadAssetAtPath(asset, typeof(Texture2D)) as Texture2D;
- if (tex == null)
- continue;
- TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, tex);
- Resources.UnloadAsset(tex);
- }
- }
- }
- }
- }
|