- Home /
WWW.LoadFromCacheOrDownload not working
I can't figure out why WWW.LoadFromCacheOrDownload is not working. Here is simple script
using UnityEngine;
using System.Collections;
public class Main : MonoBehaviour {
// Use this for initialization
void Start () {
loadAndCreate(null);
}
// Update is called once per frame
void Update () {
}
public static void loadAndCreate(string _url) {
Instantiate(WWW.LoadFromCacheOrDownload("https://www.dropbox.com/s/2ap3ixvab2lpqkn/Flame_ios.unity3d?dl=1", 1).assetBundle.mainAsset, new Vector3(0,5,0), Quaternion.identity);
}
}
It works absolutely fine in Editor. But when I load application on iPad everything I get is
starting www download: https://www.dropbox.com/s/2ap3ixvab2lpqkn/Flame_ios.unity3d?dl=1
And after this my main thread is halted. Here is the stack trace when paused:
I'm using Unity 3.5.2f2 with iPhone Pro license.
Have you tried http ins$$anonymous$$d of https?
https usually requires you to do some callback handling regarding certificate checking.
Answer by rutter · Jun 02, 2012 at 05:17 PM
Bad idea to run blocking operations on the main thread. Looks like your WWW call won't return until the asset is fully downloaded and extracted, which will effectively freeze the game until that happens.
Instead, you may want to run the WWW call as a coroutine -- with the "yield" keyword -- or check periodically to see if it has finished. There are plenty of tutorials about this around the net, but here are some links to get you started:
Your answer
Follow this Question
Related Questions
Best way to load information from server? 0 Answers
Patch/Update ios App 0 Answers
Failed to Wait on a Semaphore 2 Answers
WWW error on ios 1 Answer