Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

AssetPostprocessor

class in UnityEditor

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual

Descripción

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

During model import the functions are called in the the following order:
- OnPreprocessModel is called at the very beginning and you can override ModelImporter settings that are used for the whole model import process.
- Once Meshes and Materials are imported, we create GameObjects hierarchy from the imported nodes. Every GameObject that represents imported node gets correspondent MeshFilter, MeshRenderer and MeshCollider components. Before assigning a Material to the MeshRenderer OnAssignMaterialModel function is invoked.
- After GameObject has initialized MeshRenderers and "userdata" exists OnPostprocessGameObjectWithUserProperties is called. That happens before children GameObjects are generated.
- If animation generation was not disabled at previous stages (see ModelImporter.generateAnimations), then SkinnedMesh and Animations are generated. If possible Avatar is also created and GameObjecs hierarchy is optimized. After that OnPostprocessModel is called for the root GameObject.

OnPreprocessSpeedTree and OnPostprocessSpeedTree are called on SpeedTree assets (.spm file) the same way as OnPreprocessModel and OnPostprocessModel, except that the assetImporter type is SpeedTreeImporter.

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.

Funciones Públicas

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.

Mensajes

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).
OnPostprocessAssetbundleNameChangedHandler called when asset is assigned to a different asset bundle.
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.
OnPostprocessSpeedTreeAdd this function in a subclass to get a notification when a SpeedTree asset has completed importing.
OnPostprocessSpritesAdd this function in a subclass to get a notification when an texture of sprite(s) has completed importing.
OnPostprocessTextureAdd this function in a subclass to get a notification when a texture has completed importing just before.
OnPreprocessAnimationAdd this function in a subclass to get a notification just before animation from a model (.fbx, .mb file etc.) is imported.
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.
OnPreprocessSpeedTreeAdd this function in a subclass to get a notification just before a SpeedTree asset (.spm file) is imported.
OnPreprocessTextureAdd this function in a subclass to get a notification just before the texture importer is run.