资源导入时,预处理修改设置。官方文档链接
案例,将Texutre的Type修改为NormalMap
代码
public class MyTexturePostprocessor : AssetPostprocessor
{
void OnPreprocessTexture()
{
Debug.Log(assetPath);
if (assetPath.Contains("_bumpmap"))
{
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.convertToNormalmap = true;
textureImporter.textureType = TextureImporterType.NormalMap;
}
}
}
其他方法