unity3d Importers and (Post)Processors Texture postprocessor


Create TexturePostProcessor.cs file anywhere in Assets folder:

using UnityEngine;
using UnityEditor;

public class TexturePostProcessor : AssetPostprocessor
    void OnPostprocessTexture(Texture2D texture)
        TextureImporter importer = assetImporter as TextureImporter;
        importer.anisoLevel = 1;
        importer.filterMode = FilterMode.Bilinear;
        importer.mipmapEnabled = true;
        importer.npotScale = TextureImporterNPOTScale.ToLarger;
        importer.textureType = TextureImporterType.Advanced;

Now, every time Unity imports a texture it will have the following parameters: enter image description here

If you use postprocessor, you can not change texture parameters by manipulating Import Settings in editor.
When you hit Apply button the texture will be reimported and postprocessor code will run again.