using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class AssetBundleTool { [MenuItem("AssetBundle/SetAssetBundlesName")] public static void BuildAssetBundleName() { Object[] obj = Selection.GetFiltered(typeof(Object), SelectionMode.Unfiltered); for (int i = 0; i < obj.Length; i++) { string path = AssetDatabase.GetAssetPath(obj[i]); AssetImporter atPath = AssetImporter.GetAtPath(path); if (atPath != null) { //Debug.Log(path); atPath.assetBundleName = path; } } } [MenuItem("AssetBundle/BuildAssetBundle")] public static void BuildAssetBundle() { BuildPipeline.BuildAssetBundles("Assets/AssetBundles", BuildAssetBundleOptions.DeterministicAssetBundle, BuildTarget.StandaloneWindows); AssetDatabase.Refresh(); } }