Version: 2022.3
언어: 한국어
public static Type[] GetImporterTypes (ReadOnlySpan<GUID> guids);

파라미터

guids Array of asset GUIDs to check. The importer type for each asset in the array is returned.

설명

Returns the types of importers associated with the specified array of assets, without loading those assets.

This method is a batch version of AssetDatabase.GetImporterType. Use this method if you need to check a large number of asset importers at once. Note: GUID Arrays can be implicitly cast to ReadOnlySpan, see example for usage.

using UnityEngine;
using UnityEditor;

public class AssetDatabaseExamples { [MenuItem("AssetDatabase/GetMatchingAssetTypes")] public static void GetMatchingAssetTypes() { var matchingAssets = AssetDatabase.FindAssets("Powerup"); GUID[] guids = new GUID[matchingAssets.Length];

for(int i = 0; i < guids.Length; ++i) { guids[i] = new GUID(matchingAssets[i]); }

var matchingTypes = AssetDatabase.GetImporterTypes(guids);

foreach (var curType in matchingTypes) { Debug.Log($"Importer type: {curType}"); } } }

public static Type[] GetImporterTypes (string[] paths);

파라미터

paths Array of asset paths to check. The importer type for each asset in the array is returned.

설명

Returns the types of importers associated with the specified array of assets, without loading those assets.

The asset paths you provide should be relative to the project folder root. For example, "Assets/MyTextures/hello.png". This method is a batch version of AssetDatabase.GetImporterType. Use this method if you need to check a large number of asset importers at once.

using UnityEngine;
using UnityEditor;

public class AssetDatabaseExamples { [MenuItem("AssetDatabase/GetImporterTypeOfSelectedObjects")] public static void GetImporterTypeOfSelectedObjects() { var selectedObjects = Selection.objects; string[] paths = new string[selectedObjects.Length];

for (int i = 0; i < paths.Length; ++i) { paths[i] = AssetDatabase.GetAssetPath(selectedObjects[i]); }

var selectedObjectTypes = AssetDatabase.GetImporterTypes(paths);

foreach (var curType in selectedObjectTypes) { Debug.Log($"Importer type: {curType}"); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961