- Home /
AssetBundles Unity5 (No AssetBundle has been set for this build)
Hi, i saw the changes in Unity5 assetbundles export methods. However i need to create assetbundles in a script and run that script from command line. In unity 4.6 it worked.
I was trying to create assetbundles with this example :
@MenuItem("Test/Build Asset Bundles")
static function BuildABs() {
// Create the array of bundle build details.
var buildMap: AssetBundleBuild[] = new AssetBundleBuild[1];
buildMap[0].assetBundleName = "enemybundle";
var enemyAssets: String[] = new String[1];
enemyAssets[0] = "cube_prefab";
buildMap[0].assetNames = enemyAssets;
BuildPipeline.BuildAssetBundles("Assets/ABs", buildMap);
}
It should create assetbundles using some building map. I created a simple cube , made a prefab from it and called it cube_prefab. When i run this script i just get a warning No AssetBundle has been set for this build.
Answer by BDV · Mar 10, 2015 at 09:02 AM
I solved it, you need to put relative paths into the assetnames ... so instead of "cube_prefab" it should be "Assets/cube_prefab.prefab" and it works.
I discovered I would still "No AssetBundle has been set for this build." if the path to any of the assets is incorrect.
Answer by Desdemona_cry · Apr 16, 2015 at 07:17 PM
is this script for build assetbundle at runtime?
you need to use namespace UnityEditor so its working only in editor
Is there any way for build assetbundlet at runtime dude? i browse a thousand time and found nothing about that..