You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
945 B
30 lines
945 B
4 years ago
|
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();
|
||
|
}
|
||
|
}
|