Legacy Documentation: Version 4.6.2
Language: English
  • C#
  • JS
  • Boo

Script language

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

AssetPostprocessor

Namespace: UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

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

assetImporter Reference to the asset importer.
assetPath The path name of the asset being imported.

Functions

GetPostprocessOrder Override the order in which importers are processed.
GetVersion Returns the version of the asset postprocessor.
LogError Logs an import error message to the console.
LogWarning Logs an import warning to the console.

Messages

OnAssignMaterialModel Feeds a source material.
OnPostprocessAllAssets This is called after importing of any number of assets is complete (when the Assets progress bar has reached the end).
OnPostprocessAudio Add this function in a subclass to get a notification when an audio clip has completed importing.
OnPostprocessGameObjectWithUserProperties Gets called for each GameObject that had at least one userpropery attached to it in the imported file.
OnPostprocessModel Add this function in a subclass to get a notification when a model has completed importing.
OnPostprocessTexture Add this function in a subclass to get a notification when a texture has completed importing just before.
OnPreprocessAudio Add this function in a subclass to get a notification just before an audio clip is being imported.
OnPreprocessModel Add this function in a subclass to get a notification just before a model (.fbx, .mb file etc.) is imported.
OnPreprocessTexture Add this function in a subclass to get a notification just before the texture importer is run.