2023-06-18 21:49:14 +00:00
|
|
|
using System.IO;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2022-06-12 19:32:00 +00:00
|
|
|
using UnityEditor;
|
2023-06-18 21:49:14 +00:00
|
|
|
using UnityEditor.Build;
|
|
|
|
using UnityEditor.Build.Reporting;
|
2022-06-12 19:32:00 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class CreateAssetBundles
|
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
[MenuItem("Assets/Build AssetBundles/Current Platform")]
|
|
|
|
static void BuildAllAssetBundlesCurrPlatform()
|
2022-06-12 19:32:00 +00:00
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
string assetBundleDirectory = "Assets/StreamingAssets";
|
|
|
|
if (!Directory.Exists(Application.streamingAssetsPath))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(assetBundleDirectory);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
|
|
|
|
}
|
|
|
|
|
|
|
|
[MenuItem("Assets/Build AssetBundles/Windows")]
|
|
|
|
static void BuildAllAssetBundlesWindows()
|
2022-06-12 19:32:00 +00:00
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
string assetBundleDirectory = "Assets/StreamingAssets/Windows";
|
|
|
|
if (!Directory.Exists(Application.streamingAssetsPath))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(assetBundleDirectory);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows);
|
2022-06-12 19:32:00 +00:00
|
|
|
}
|
2023-10-29 19:44:47 +00:00
|
|
|
|
|
|
|
[MenuItem("Assets/Build AssetBundles/Linux")]
|
|
|
|
static void BuildAllAssetBundlesLinux()
|
|
|
|
{
|
|
|
|
string assetBundleDirectory = "Assets/StreamingAssets/Linux";
|
|
|
|
if (!Directory.Exists(Application.streamingAssetsPath))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(assetBundleDirectory);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneLinux64);
|
|
|
|
}
|
|
|
|
|
|
|
|
[MenuItem("Assets/Build AssetBundles/Mac")]
|
|
|
|
static void BuildAllAssetBundlesMacOS()
|
|
|
|
{
|
|
|
|
string assetBundleDirectory = "Assets/StreamingAssets/Mac";
|
|
|
|
if (!Directory.Exists(Application.streamingAssetsPath))
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(assetBundleDirectory);
|
|
|
|
}
|
|
|
|
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneOSX);
|
2022-06-12 19:32:00 +00:00
|
|
|
}
|
|
|
|
}
|