Can't Load Assetbundle On iOS

Hi all.

i was trying my best not too ask question. but i could not get it to work. been working on asset bundle for sometime now. i was able to create the asset bundle and it work perfectly with osx and web. but i can’t get it to load on on the iPhone. look around for the answer, and here what i found. http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/

but it does not seem to load in local and web. and i wondering if you guys let me know what did i do wrong. i know apple stick us from assess var/mobile… so is there any way i can make it work?

P.s. i already build the asset success and i try to place it in Xcode. thank in advance.

Thank in advance.

Here my loading code
using System;
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
private WWW www;
private AssetBundleRequest gameObjectRequest;
// Use this for initialization
IEnumerator Start () {
//TODO: change the name of the file below!!!
String strPath = “file://” + Application.dataPath + “/…/iphone-prefab-sphere.assetbundle”;
Debug.Log(strPath);
www = new WWW(strPath);
yield return www;
/* TODO: change the name “Box” to match the name of your prefab that you compiled into the assetbundle on step 1. */

//AssetBundleRequest request = www.assetBundle.LoadAsync(“Sphere”, typeof(GameObject));
yield return request;
Instantiate(request.asset, new Vector3(3f, 0f, 0f), Quaternion.identity);
Instantiate(request.asset, new Vector3(0f, 0f, 0f), Quaternion.identity);
Instantiate(request.asset, new Vector3(-3f, 0f, 0f), Quaternion.identity);
www.assetBundle.Unload(true);
}
void Update() { }
}

you likely don’t build the asset bundle for the iOS platform.
Asset bundles only work for the platform they were built and only on the unity version they were built with.

Also keep in mind that you must own Unity iOS Pro to use Asset Bundles.

PS: The path is incorrect for granted, on iOS the file will NEVER be there.
if you download it from the web, instead use WWW.LoadFromCacheOrDownload which significantly reduces the load times as it stores the cached asset bundles uncompressed

@dreamora, would you be kind enough to comment on my post.

http://forum.unity3d.com/threads/124447-Unity-version-for-building-vs-loading-AssetBundles

Thanks.

I found this really helpful, hopefully others looking here will too:

http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/

It is possible to get access to files in the XCode project by first getting Asset.DataPath, and traversing the directory one level to files within the root of the xcode project, eg:

“file://” + Application.dataPath + “/…/Packaged_iOS/” + bundleGroupNames[type] + “.unity3d”;