Last active
January 20, 2019 12:45
-
-
Save unitycoder/672c2b600fa681c0bbc2 to your computer and use it in GitHub Desktop.
CreateAssetBundles snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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