Class ModularImporter
Abstract base class for custom asset importer using an Importer
Modular 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 Scripted
Inherited Members
Namespace: UnityEditor .Importer
Assembly: Unity.Importer.Editor.dll
Syntax
public abstract class ModularImporter : ScriptedImporter
Properties
DefaultGraphPath
A project path where the default Importer
Declaration
protected virtual string DefaultGraphPath { get; }
Property Value
Type | Description |
---|---|
string |
Examples
using UnityEditor.Importer;
[ModularImporter(version: 1, ext: "sphere")]
public class SphereImporter : ModularImporter
{
protected override ImporterGraph DefaultGraphPath => "Assets/DefaultImporters/SphereImporter.asset";
}
ErrorIdsToTrack
A set of ids to track for analytics.
Declaration
protected virtual HashSet<int> ErrorIdsToTrack { get; }
Property Value
Graph
The Importer
Declaration
public LazyLoadReference<ImporterGraph> Graph { get; set; }
Property Value
Type | Description |
---|---|
Lazy |
ImportSettingOverrides
The import setting overrides declared for this importer.
Declaration
public IReadOnlyList<IGraphValue> ImportSettingOverrides { get; }
Property Value
Type | Description |
---|---|
IRead |
WarningIdsToTrack
A set of warning ids to track for analytics.
Declaration
protected virtual HashSet<int> WarningIdsToTrack { get; }
Property Value
Methods
AddImportSettingOverride(IGraphValue)
Add an Import
Declaration
public ModularImporterValidationResult AddImportSettingOverride(IGraphValue setting)
Parameters
Type | Name | Description |
---|---|---|
IGraph |
setting | An Import |
Returns
Type | Description |
---|---|
Modular |
The Modular |
OnFinishingAssetImport(GraphLogger)
This method is called at the end of the import.
Declaration
protected virtual void OnFinishingAssetImport(GraphLogger graphLogger)
Parameters
Type | Name | Description |
---|---|---|
Graph |
graphLogger | The graph logger. |
OnImportAsset(AssetImportContext)
This method is called by the Asset pipeline to import files.
Declaration
public override void OnImportAsset(AssetImportContext ctx)
Parameters
Type | Name | Description |
---|---|---|
Asset |
ctx | This argument contains all the contextual information needed to process the import event and is also used by the custom importer to store the resulting Unity Asset. |
Overrides
Remarks
It is already implemented by the Modular
ProcessImportResult(IReadOnlyList<IGraphValue>, AssetImportContext)
This method is called at the end of the import if the Graph execution was a success.
Declaration
protected virtual void ProcessImportResult(IReadOnlyList<IGraphValue> results, AssetImportContext ctx)
Parameters
Type | Name | Description |
---|---|---|
IRead |
results | A readonly list of Import |
Asset |
ctx | This argument contains all the contextual information needed to process the import event and is also used by the custom importer to store the resulting Unity Asset. |
Remarks
The default implementation looks for Object to add them in the Asset
RemoveImportSettingOverride(IGraphValue)
Remove an Import
Declaration
public ModularImporterValidationResult RemoveImportSettingOverride(IGraphValue setting)
Parameters
Type | Name | Description |
---|---|---|
IGraph |
setting | An Import |
Returns
Type | Description |
---|---|
Modular |
The Modular |
Validate()
Validate this Modular
Declaration
public ModularImporterValidationResult Validate()
Returns
Type | Description |
---|---|
Modular |
The Modular |