/**************************************************** 文件:SpecialFolderFileInit.cs 作者:陶长春 邮箱:376248129@qq.com 日期:2025年3月24日 7:32:11 UnityVersion: 2021.3.13f1 功能:特殊文件夹文件创建处理 *****************************************************/ using System.Collections; using UnityEngine; using System.Collections.Generic; using UnityEditor; using System; using System.IO; namespace TFramework { public class SpecialFolderFileInit:AssetPostprocessor { void OnPreprocessTexture() { string suffix = Path.GetExtension(assetPath); if ((suffix == ".png" || suffix == ".jpg") && assetPath.Contains("Sprite")) InitSprite(assetPath); } private void InitSprite(string arg0) { TextureImporter importer = assetImporter as TextureImporter; if(importer) { importer.textureType = TextureImporterType.Sprite; AssetDatabase.ImportAsset(arg0, ImportAssetOptions.ForceUpdate); } } } }