2025-09-02 01:12:08 +08:00
|
|
|
using System.IO;
|
|
|
|
using UnityEditor;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Convention
|
|
|
|
{
|
|
|
|
public class FileEditor : AbstractCustomEditor
|
|
|
|
{
|
|
|
|
[MenuItem("Convention/AssetBundle/Create for Android")]
|
|
|
|
static void CreatAssetBundle()
|
|
|
|
{
|
2025-10-05 02:10:18 +08:00
|
|
|
string path = Path.Combine(Application.dataPath, "../", "AssetBundle", "Android");
|
2025-09-02 01:12:08 +08:00
|
|
|
if (!Directory.Exists(path))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(path);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.Android);
|
|
|
|
UnityEngine.Debug.Log("Android Finish!");
|
|
|
|
}
|
|
|
|
|
|
|
|
[MenuItem("Convention/AssetBundle/Create for IOS")]
|
|
|
|
static void BuildAllAssetBundlesForIOS()
|
|
|
|
{
|
2025-10-05 02:10:18 +08:00
|
|
|
string dirName = "AssetBundles/IOS/";
|
2025-09-02 01:12:08 +08:00
|
|
|
if (!Directory.Exists(dirName))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(dirName);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(dirName, BuildAssetBundleOptions.None, BuildTarget.iOS);
|
|
|
|
UnityEngine.Debug.Log("IOS Finish!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
[MenuItem("Convention/AssetBundle/Create for Windows")]
|
|
|
|
static void CreatPCAssetBundleForwINDOWS()
|
|
|
|
{
|
2025-10-05 02:10:18 +08:00
|
|
|
string path = Path.Combine(Application.dataPath, "../", "AssetBundle", "Windows");
|
2025-09-02 01:12:08 +08:00
|
|
|
if (!Directory.Exists(path))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(path);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
|
|
|
|
UnityEngine.Debug.Log("Windows Finish!");
|
|
|
|
}
|
|
|
|
|
|
|
|
[MenuItem("Convention/AssetBundle/Create for Mac")]
|
|
|
|
static void CreatPCAssetBundleForMac()
|
|
|
|
{
|
2025-10-05 02:10:18 +08:00
|
|
|
string path = Path.Combine(Application.dataPath, "../", "AssetBundle", "Mac");
|
2025-09-02 01:12:08 +08:00
|
|
|
if (!Directory.Exists(path))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(path);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX);
|
|
|
|
UnityEngine.Debug.Log("Mac Finish!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|