AssetDatabase.GetAssetPathsFromAssetBundle
を利用することで
Asset に設定してある assetBundleName
が一致するアセットのパスを取得できます
アセットバンドル名は重複を許可しているため、複数のパスが取得することができるので注意が必要です
using UnityEditor; using UnityEngine; public UnityEngine.Object GetBundleAsset(string bundleName) { var paths = AssetDatabase.GetAssetPathsFromAssetBundle(bundleName); if (paths.Length == 0) { return null; } return AssetDatabase.LoadAssetAtPath(paths[0]); }