- Home /
WWW object it's not retrieving bundle Aset
I'm trying to get an asset bundle with the metadata retrieved by an scanned image via cloud. I already get the metadata which has the path where the metadata is, but it seems the WWW object it's no getting anything.
here is the code in which im doing the tracking.
IEnumerator DownloadAndCache()
{
while (!Caching.ready)
yield return null;
using (WWW www = WWW.LoadFromCacheOrDownload(bundleURL, 29))
{
yield return www;
if (www.error != null)
throw new UnityException("WWW Download had an error: " + www.error);
AssetBundle bundle = www.assetBundle;
mBundleInstance = Instantiate(bundle.mainAsset) as GameObject;
}
}
public void OnTrackableStateChanged(
TrackableBehaviour.Status previousStatus,
TrackableBehaviour.Status newStatus)
{
if (newStatus == TrackableBehaviour.Status.DETECTED ||
newStatus == TrackableBehaviour.Status.TRACKED ||
newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
{
GameObject go = GameObject.Find("CloudRecognition");
SimpleCloudHandler cloudMeta = go.GetComponent<SimpleCloudHandler>();
bundleURL = cloudMeta.mTargetMetadata;
StartCoroutine(DownloadAndCache());
if (!mAttached && mBundleInstance)
{
// if bundle has been loaded, let's attach it to this trackable
mBundleInstance.transform.parent = this.transform;
mBundleInstance.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
mBundleInstance.transform.localPosition = new Vector3(0.0f, 0.15f, 0.0f);
mBundleInstance.transform.gameObject.SetActive(true);
mAttached = true;
}
}
}
an this is the path :
file:///C:/Users/Salvador/Desktop/metaData/test.unity3d
Comment