Question by
Salina-Igneous · Apr 20, 2020 at 08:54 AM ·
animationspriteassetbundlewww
Using Asset Bundle on Web Server for image sequence animation
I'm making an AR app that uses sprite animations for it's content, with the images stored onto a web server as an asset bundle.
I've created the asset bundle and managed to get my unity project to download it from the web server at runtime just fine. But I can't the sprite renderers to find the sprites at run time. I think I need to get unity to load this sprites into the assets folder, but I don't know how to do that.
I'm probably missing something out that's really silly, any help is appreciated.
Here is the Script I'm using:
using System.Collections; using System.Collections.Generic; using UnityEngine.Networking; using UnityEngine;
public class LoadAssetBundleOnline : MonoBehaviour {
AssetBundle assetBundle;
public string bundleURL;
void Start()
{
StartCoroutine(GetOnlineBundle());
}
IEnumerator GetOnlineBundle()
{
// Request and wait for the desired page.
WWW webRequest = WWW.LoadFromCacheOrDownload(bundleURL, 0);
while(!webRequest.isDone)
{
Debug.Log(webRequest.progress);
yield return null;
}
if(webRequest.error == null)
{
assetBundle = webRequest.assetBundle;
Debug.Log("Success");
assetBundle.LoadAllAssetsAsync();
}
else
{
Debug.Log("Failed");
}
}
}
Comment