Unity resource import preprocessing

When the resource is imported, the preprocessing modifies the settings. Official document link

Case, change the Type of Texutre to NormalMap

 the code

public class MyTexturePostprocessor : AssetPostprocessor
{
    void OnPreprocessTexture()
    {
        Debug.Log(assetPath);
        if (assetPath.Contains("_bumpmap"))
        {
            TextureImporter textureImporter = (TextureImporter)assetImporter;
            textureImporter.convertToNormalmap = true;
            textureImporter.textureType = TextureImporterType.NormalMap;
        }
    }
}

Other methods

Guess you like

Origin blog.csdn.net/LuffyZ/article/details/129149995