Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetAssetPathsFromAssetBundleAndAssetName(string, string)

Get the Asset paths for all Assets tagged with assetBundleName and named assetName.
Read time 1 minuteLast updated 13 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public static string[] GetAssetPathsFromAssetBundleAndAssetName(string assetBundleName, string assetName)

Parameters

assetBundleName

The name of the AssetBundle.

assetName

The name of the asset.

Returns

Type

Description

string[]

Remarks

Get the Asset paths for all Assets tagged with assetBundleName and named assetName, regardless of extension or path e.g. "Assets/House.prefab", "Assets/Textures/House.png" and "Assets/Data/House.xml" when assetName is "House".

Examples

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); }}