Version: 2020.1
Experimental: this API is experimental and might be changed or removed in the future.


class in UnityEditor.Experimental.AssetImporters





Abstract base class for custom Asset importers.

Scripted importers are scripts that are associated with specific file extensions. They are invoked by Unity's Asset pipeline to convert the contents of associated files into Assets.

Use the ScriptedImporterAttribute class to register custom importers with the Asset pipeline.

using UnityEngine;
using UnityEditor.Experimental.AssetImporters;
using System.IO;

[ScriptedImporter(1, "cube")] public class CubeImporter : ScriptedImporter { public float m_Scale = 1;

public override void OnImportAsset(AssetImportContext ctx) { var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); var position = JsonUtility.FromJson<Vector3>(File.ReadAllText(ctx.assetPath));

cube.transform.position = position; cube.transform.localScale = new Vector3(m_Scale, m_Scale, m_Scale);

// 'cube' is a a GameObject and will be automatically converted into a Prefab // (Only the 'Main Asset' is elligible to become a Prefab.) ctx.AddObjectToAsset("main obj", cube); ctx.SetMainObject(cube);

var material = new Material(Shader.Find("Standard")); material.color =;

// Assets must be assigned a unique identifier string consistent across imports ctx.AddObjectToAsset("my Material", material);

// Assets that are not passed into the context as import outputs must be destroyed var tempMesh = new Mesh(); DestroyImmediate(tempMesh); } }

Public 関数

OnImportAssetThis method must by overriden by the derived class and is called by the Asset pipeline to import files.
SupportsRemappedAssetTypeOverride this method if your ScriptedImporter supports remapping specific asset types.


GatherDependenciesFromSourceFileA static callback that you can implement to set up artifact dependencies to other Assets, and optimize the order your assets are imported.
OnValidateThis function is called when the importer is loaded or a value is changed in the Inspector.



importSettingsMissingThe value is true when no meta file is provided with the imported asset.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?

Public 関数

AddRemapMap a sub-asset from an imported asset (such as an FBX file) to an external Asset of the same type.
GetExternalObjectMapGets a copy of the external object map used by the AssetImporter.
RemoveRemapRemoves an item from the map of external objects.
GetInstanceIDオブジェクトのインスタンス ID を返します
ToStringReturns the name of the object.

Static 関数

GetAtPathアセットのパスから AssetImporter を取得します
DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeGets a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします


operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。