Version: 2022.2
언어: 한국어
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}"); } } }