I have an android app made with Unity and whenever I try to load my asset bundles inside unity I get this error :
my build API level
however I built my asset bundles in API Level 16 and when I build the app with API Level 16 & 19 doesnt make difference still gives me the same error
CodePudding user response:
As the error states that you are trying to load an asset bundle in android platform which is not build for android platform. Please use below code for specific platform. I am sure you have follow this which by default builds for windows only.
using UnityEditor;
using System.IO;
public class CreateAssetBundles
{
[MenuItem("Assets/Build AssetBundles")]
static void BuildAllAssetBundles()
{
string assetBundleDirectory = "Assets/AssetBundles";
if(!Directory.Exists(assetBundleDirectory))
{
Directory.CreateDirectory(assetBundleDirectory);
}
BuildPipeline.BuildAssetBundles(assetBundleDirectory,
BuildAssetBundleOptions.None,
EditorUserBuildSettings.activeBuildTarget);
}
}
This code will build asset bundle for current selected platform.