自动对导入的Texture进行基础设置
using UnityEngine;
using UnityEditor;
using System.IO;
public class AutoAssetsImportSitting : AssetPostprocessor {
/// <summary>
/// Hook,用于自动设置导入Texture的设置
/// 1.把导入的图片默认设置为Sprite
/// 2.设置spriteMode默认为Single
/// 3.设置Packing Tag为存放Texture的文件夹名
/// 4.取消Mipmap的勾选
/// 5.设置为带透明通道
/// 6.设置Read/Write Enable状态为未勾选
/// 7.设置wrapMode默认为Clamp
/// </summary>
/// <param name="texture"></param>
void OnPostprocessTexture(Texture2D texture){
string AtlasName = new DirectoryInfo(Path.GetDirectoryName(assetPath)).Name;
TextureImporter textureImporter = assetImporter as TextureImporter;
textureImporter.textureType = TextureImporterType.Sprite;
textureImporter.spriteImportMode = SpriteImportMode.Single;
textureImporter.spritePackingTag = AtlasName;
textureImporter.mipmapEnabled = false;
textureImporter.alphaIsTransparency = true;
textureImporter.isReadable = false;
textureImporter.wrapMode = TextureWrapMode.Clamp;
}
}