首页 > 代码库 > unity学习 5.x打包

unity学习 5.x打包

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class buildab {
[MenuItem("Publish/Build Bundle")]
public static void BuildBundle()
{
List<AssetBundleBuild> builds = new List<AssetBundleBuild>();
AssetBundleBuild b = new AssetBundleBuild();
b.assetBundleName = "2000.assetbundle";
b.assetNames = new string[] { "Assets/New Material.mat" };
builds.Add(b);
BuildPipeline.BuildAssetBundles("Assets/Bundle", builds.ToArray(), BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, EditorUserBuildSettings.activeBuildTarget);
}
}

unity学习 5.x打包