AssetBundles are not working outside editor on PC or Android.

So, im just playing around with AssetBundles to store sound packs outside of the original .apk to reduce file size. I seem to have the system worked out, as it runs exactly how I would like while running in editor, unfortunately attempting the same processes outside of editor is failing and I’m not sure why…

Here is the snippet of code for the actual downloading of the file. What I’m trying to do is download the AssetBundle, then extract a base .xml of the files inside and save that elsewhere.

	//work in editor
	public IEnumerator DownloadBundle()
	{
		if(!Directory.Exists(Application.persistentDataPath + "/Bundles"))
			Directory.CreateDirectory(Application.persistentDataPath + "/Bundles");
	
		WWW www = new WWW(url);
		yield return www;

		//save to assetbundle to disk
		SaveBytesAsFile(downloadPath, www.bytes);
	
		//load in asset from disk
		currentBundle = AssetBundle.CreateFromFile(Application.persistentDataPath + "/Bundles/AssetBundle.unity3d");
		yield return currentBundle;
	
		if(!Directory.Exists(Application.persistentDataPath + "/BundleData"))
			Directory.CreateDirectory(Application.persistentDataPath + "/BundleData");
	
		TextAsset a = currentBundle.Load("Bytes", typeof(Object)) as TextAsset;

		File.WriteAllBytes(Application.persistentDataPath + "/BundleData/Bytes.xml", a.bytes);
	}

Yeah, ignore the terrible formatting…

Any help on this would be greatly appreciated :slight_smile:

What’s the platform of your asset bundles? My guess is PC (i.e. Standalone). AssetBundles are platform specific and you must build separate AssetBundles for each platform.