using System.IO;
using UnityEditor;
using UnityEngine;
public static class ExportResource
{
[MenuItem("vAssets/Build AssetBundle From Selection - Track dependencies")]
static void DoExportResourceBundles()
{
// Bring up save panel
var path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0)
{
// Build the resource file from the active selection.
var selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
//var buildTarget = BuildTarget.Standalone;
//BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildTarget.Standalone);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
Selection.objects = selection;
}
}
[MenuItem("vAssets/Build AssetBundle From Selection - No dependency tracking")]
static void DoExportResourceFbx()
{
// Bring up save panel
var path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0)
{
// Build the resource file from the active selection.
BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path);
}
}
}
Unity4导出AssetsBunle C#
最新推荐文章于 2022-11-15 16:45:42 发布