using System; using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class FUIImporter : AssetPostprocessor { // private void OnPostprocessTexture(Texture2D texture) // { // var importer = this.assetImporter as TextureImporter; // string dirName = System.IO.Path.GetDirectoryName(importer.assetPath); // // if (dirName.EndsWith("\\FUI")) // { // importer.mipmapEnabled = false; // importer.filterMode = FilterMode.Bilinear; // } // } private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { string suffix = ".unity3d"; foreach (var path in importedAssets) { string dirName = System.IO.Path.GetDirectoryName(path); if (dirName.EndsWith("\\FUI")) { if (path.EndsWith(".png")) { TextureImporter importer = AssetImporter.GetAtPath(path) as TextureImporter; importer.mipmapEnabled = false; importer.filterMode = FilterMode.Bilinear; string fileName = System.IO.Path.GetFileNameWithoutExtension(path); int index = fileName.LastIndexOf('_'); string resBundleName = fileName.Substring(0, index); importer.assetBundleName = resBundleName.ToLower() + "_fui_res" + suffix; } else if (path.EndsWith(".bytes")) { string fileName = System.IO.Path.GetFileNameWithoutExtension(path); AssetImporter importer = AssetImporter.GetAtPath(path); importer.assetBundleName = fileName.ToLower() + suffix; } } } } }