Version: 2020.1
언어: 한국어

AssetDatabase.GetAssetPathsFromAssetBundle

매뉴얼로 전환
public static string[] GetAssetPathsFromAssetBundle (string assetBundleName);

설명

Returns an array containing the paths of all assets marked with the specified Asset Bundle name.

All paths returned are relative to the project folder, for example: "Assets/MyTextures/hello.png" will be returned if "hello.png" has been added to an Asset Bundle.

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class GetAssetPathsFromAssetBundleExample : MonoBehaviour { [MenuItem("APIExamples/GetAssetPathsFromAssetBundle")] static void GatherAllAssetsInAssetBundles() { string[] allAssetBundles = AssetDatabase.GetAllAssetBundleNames();

List<string> allAssetsInAnAssetBundle = new List<string>(); for (int i = 0; i < allAssetBundles.Length; ++i) { var curBundleName = allAssetBundles[i]; var assetsInCurBundle = AssetDatabase.GetAssetPathsFromAssetBundle(curBundleName);

allAssetsInAnAssetBundle.AddRange(assetsInCurBundle); }

//allAssetsInAnAssetBundle now contains all assets that belong to an asset bundle } }