Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active January 20, 2019 12:45
Show Gist options
  • Save unitycoder/672c2b600fa681c0bbc2 to your computer and use it in GitHub Desktop.
Save unitycoder/672c2b600fa681c0bbc2 to your computer and use it in GitHub Desktop.
CreateAssetBundles snippet
using System.IO;
using UnityEditor;
using UnityEngine;
// from http://docs.unity3d.com/Manual/BuildingAssetBundles.html
public class CreateAssetBundles
{
[MenuItem("Assets/Build AssetBundles")]
static void BuildAllAssetBundles()
{
var path = Application.dataPath + "/AssetBundles";
if (!Directory.Exists(path))
{
Debug.Log("No AssetBundles directory, creating it : " + path);
Directory.CreateDirectory(path);
AssetDatabase.Refresh();
}
BuildPipeline.BuildAssetBundles("Assets/AssetBundles");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment