unityシーンパッケージングスクリプトBuildSceneEditor
1890 ワード
using UnityEngine;
using System.Collections;
using UnityEditor;
public class BuildSceneEditor{
[MenuItem("Build/BuildWebPlayerStreamed")]
static void BuildScene()
{
string[] levels = new string[] { Application.dataPath + "/Scenes/bb.unity" };
BuildPipeline.BuildStreamedSceneAssetBundle(levels, "main.unity3d", BuildTarget.WebPlayer);
}
[MenuItem("Build/Build Assets")]
static void ExportResources()
{
string path = EditorUtility.SaveFilePanel("Save Resource", "", "2DUI", "unity3d");
if (path.Length != 0)
{
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject,
selection,
path,
BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,
BuildTarget.WebPlayer);
Selection.objects = selection;
}
}
}