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