Unity资源导入预处理

资源导入时,预处理修改设置。官方文档链接

案例,将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;
        }
    }
}

其他方法

猜你喜欢

转载自blog.csdn.net/LuffyZ/article/details/129149995
今日推荐