Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AssetPostprocessor

Namespace: UnityEditor

Description

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

In a production pipeline AssetPostprocessors should always be placed in pre-built dll's in the project instead of in scripts. AssetPostprocessors change the output of imported assets, thus a compile error in one of the scripts will lead to assets being imported differently. This can be a severe issue when working in a production pipeline. By using dll's for AssetPostprocessors you ensure that they can always be executed even if the scripts have compile errors. This way you can override default values in the import settings or modify the imported data like textures or meshes.

Variables

assetImporterReference to the asset importer.
assetPathThe path name of the asset being imported.

Functions

GetPostprocessOrderOverride the order in which importers are processed.
GetVersionReturns the version of the asset postprocessor.
LogErrorLogs an import error message to the console.
LogWarningLogs an import warning to the console.

Messages

OnAssignMaterialModelFeeds a source material.
OnPostprocessAllAssetsThis is called after importing of any number of assets is complete (when the Assets progress bar has reached the end).
OnPostprocessAudioAdd this function in a subclass to get a notification when an audio clip has completed importing.
OnPostprocessGameObjectWithUserPropertiesGets called for each GameObject that had at least one userpropery attached to it in the imported file.
OnPostprocessModelAdd this function in a subclass to get a notification when a model has completed importing.
OnPostprocessTextureAdd this function in a subclass to get a notification when a texture has completed importing just before.
OnPreprocessAudioAdd this function in a subclass to get a notification just before an audio clip is being imported.
OnPreprocessModelAdd this function in a subclass to get a notification just before a model (.fbx, .mb file etc.) is imported.
OnPreprocessTextureAdd this function in a subclass to get a notification just before the texture importer is run.