打包AssetBundle代码
`using UnityEditor;
using System.IO;
using UnityEngine;
public class CreateAssetBundles
{
//创建打包按钮
[MenuItem(“Assets/Build AssetBundles”)]
static void BulidAllAssetBundles()
{
//创建文件夹
string assetBundleDirectory = “Assets/StreamingAssets”;
if (!Directory.Exists(Application.streamingAssetsPath))
{
Directory.CreateDirectory(assetBundleDirectory);
}
//打包
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None,
EditorUserBuildSettings.activeBuildTarget);
}
}`
命名规则:为了方便管理,我们通常命名AssetBundle的时候带有文件夹路径:
我在这里根据文件夹命名的Scenes1/Building1 (不去分大小写)
打包之后的Mainfest文件夹就会出现在代码所指定的路径
来源:CSDN
作者:qq_37129758
链接:https://blog.csdn.net/qq_37129758/article/details/103945181