- Home /
Question by
smtabatabaie · Oct 31, 2014 at 08:28 AM ·
assetbundleassetscene-loadingpipeline
Loading assetbundle problem
Hi, I have this simple code for creating my asset bundle :
[MenuItem ("Build/BuildAssetBundle")]
static void myBuild(){
string[] levels = {"Assets/main.unity"};
BuildPipeline.BuildStreamedSceneAssetBundle(levels,"Streamed-Level1.unity3d",BuildTarget.Android);
}
and I use above code to build asset bundle from a scene which in has a camera and a cube in center.
and I have this code to load it:
using UnityEngine;
using System.Collections;
public class loader : MonoBehaviour {
public GUIText debugger;
private string url = "http://www.myurl.com/Streamed-Level1.unity3d";
// Use this for initialization
IEnumerator Start () {
Debug.Log("starting");
WWW www = WWW.LoadFromCacheOrDownload(url,1);
if(www.error != null)
{
Debug.LogError(www.error);
}
yield return www;
Debug.Log("after yield");
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Debug.Log("loaded all");
Application.LoadLevel("main");
}
// Update is called once per frame
void Update () {
}
}
The problem is seems to be when it gets to get to loadAll it stops.
I'll appreciate if anyone can help me with this.
Thanks very much
Comment
Answer by MEDIALLIANCE_2 · Mar 18, 2015 at 01:45 PM
Which platform?
I've got the same problem. It works fine on PC but not on Android. The limitation I see, is that bundles are not fully compatible from PC to Android. Try to create your bundle under the correct platform.
-EDIT- I tried, and that was it: bundle creation under the correct platform.