Skip to content

Instantly share code, notes, and snippets.

@TomoakiNagahara
Last active August 31, 2015 16:43
Show Gist options
  • Save TomoakiNagahara/1671f2b7bdbcc772143c to your computer and use it in GitHub Desktop.
Save TomoakiNagahara/1671f2b7bdbcc772143c to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
public class ExportAssetBundles : MonoBehaviour
{
[MenuItem("Assets/Unity 5.x Build AssetBundle")]
static void ExportResource_Unity5()
{
Debug.Log("Target=" + EditorUserBuildSettings.activeBuildTarget.ToString());
// Folder name is PlatForm name
string OutPutPath = Application.streamingAssetsPath + "/" + EditorUserBuildSettings.activeBuildTarget.ToString();
if (Directory.Exists(OutPutPath) == false )
{
Directory.CreateDirectory(OutPutPath);
}
// Build AssetBundle at platform manifest.
BuildPipeline.BuildAssetBundles(OutPutPath, 0, EditorUserBuildSettings.activeBuildTarget);
Debug.Log("ComPress End");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment