获取标记为 assetBundleName 且名为 assetName 的所有 Asset 的 Asset 路径。
获取标记为 assetBundleName 且名为 assetName 的所有 Asset 的 Asset 路径,不考虑扩展名或路径,例如,当 assetName 为“House”时为“Assets/House.prefab”、“Assets/Textures/House.png”和“Assets/Data/House.xml”。
using UnityEditor; using UnityEngine;
public class ExampleScript { [MenuItem("AssetDatabase/Display assets in an AssetBundle")] static void ExampleScriptCode1() { string[] assetPaths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName("assetname", "House"); foreach (var assetPath in assetPaths) Debug.Log(assetPath); }
[MenuItem("AssetDatabase/AssetBundle creation")] static void ExampleScriptCode2() { BuildPipeline.BuildAssetBundles("Assets/AssetBundles", BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX); } }