Unity - Scripting API: AssetImporter

class in UnityEditor

/

Inherits from:Object

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

Submission failed

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

Close

Cancel

Description

Provides access to import settings and base functionality for all asset types.

Although this is the base class for all asset importers, the recommended best practice is that you derive from the ScriptedImporter class if you want to write a new, custom importer.

Each asset imported into the project is linked to a corresponding asset importer object. This object provides access to the settings applied during the asset import process. These settings are stored in the .meta file, are located adjacent to the source asset file. They encompass asset bundle information, custom user data, and any external objects upon which the asset relies.

To obtain the asset importer object associated with an asset, use the AssetImporter.GetAtPath method.

To apply and save any changes made to the settings, use the AssetImporter.SaveAndReimport method. This action reimports the asset with the updated configuration.

The following example iterates through all assets within the project, identifying those that lack an asset bundle name by examining their respective asset importer objects.

Static Methods

Method Description
GetAtPathRetrieves the asset importer for the asset at path.
GetImportLogRetrieves logs generated during the import of the asset at path.

Inherited Members

Properties

PropertyDescription
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

MethodDescription
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static Methods

MethodDescription
DestroyRemoves a GameObject, component, or asset.
DestroyImmediateDestroys the specified object immediately. Use with caution and in Edit mode only.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.

Operators

OperatorDescription
boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.