AssetPostprocessor Class  

Scripting > Editor Classes > AssetPostprocessor

AssetPostprocessor lets you hook into the import pipeline and run scripts prior or after importing assets.

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

This way you can override default values in the import settings or modify the imported data like textures or meshes.

Variables
assetPath

The path name of the asset being imported.

assetImporter

Reference to the asset importer

preview

Assign a custom texture to this variable to generate a preview of the imported asset

Functions
LogWarning

Logs an import warning to the console.

LogError

Logs an import error message to the console.

GetPostprocessOrder

Override the order in which importers are processed.

Messages Sent
OnPreprocessTexture

Override this function in a subclass to get a notification just before the texture importer is run.

OnPostprocessTexture

Override this function in a subclass to get a notification when a texture has completed importing just before the texture is saved to disk.

OnPreprocessModel

Override this function in a subclass to get a notification just before a model (.fbx, .mb file etc.) is being imported.

OnPostprocessModel

Override this function in a subclass to get a notification when a model has completed importing

OnAssignMaterialModel

Feeds a source material

OnPostprocessAudio

OnPreprocessAudio

OnPostprocessAllAssets

OnPostprocessAllAssets is called after importing of several assets is complete. (The Assets progress bar has reached the end)