From http://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundle.html, I am using the sample code
using UnityEngine;
using UnityEditor;
public class ExportAssetBundles {
[MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
static void ExportResource () {
// Bring up save panel
string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0) {
// Build the resource file from the active selection.
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path,
BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
Selection.objects = selection;
}
}
[MenuItem("Assets/Build AssetBundle From Selection - No dependency tracking")]
static void ExportResourceNoTrack () {
// Bring up save panel
string 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);
}
}
}
To build an AssetBundle. However, whenever I run this on a prefab, I noticed that Unity switches the platform to WebPlayer and THEN builds the bundle. But I need the AssetBundle to be built for iOS and Android - I don't need WebPlayer bundles.
Why does it keep switching to WebPlayer platform whenever I run this? How can I build for iOS and Android?
My prefab is just an object with a Sprite Renderer.