Version: 2023.1

AssetImportContext

class in UnityEditor.AssetImporters

切换到手册

描述

在导入事件期间定义脚本化导入器的导入上下文。

此类包含 OnImportAsset() 任务的输入和输出信息。

变量

assetPath要导入的源资源文件的路径。
mainObjectAssetImportContext 上设置的主要对象。
selectedBuildTargetReturns the current build target and creates a dependency on the target platform within a scripted importer.

公共函数

AddObjectToAsset向导入操作的结果添加对象。
DependsOnArtifactSetup artifact dependency to an asset.
DependsOnCustomDependencyAllows you to specify that an Asset has a custom dependency.
DependsOnSourceAssetAllows you to specify that an Asset depends directly on the source file of another Asset (as opposed to the import result of another asset).
GetArtifactFilePathReturns the path of the Artifact file that was created by another importer, and adds a dependency to that file.
GetObjects获取 AssetImportContext 上设置的对象列表。
GetOutputArtifactFilePathReturns the path where to write a new Artifact File with the given fileName.
LogImportError记录导入期间遇到的错误消息。
LogImportWarning记录导入期间遇到的警告消息。
SetMainObject设置导入的主要对象。