/* Load or download assetbundle and place assets from bundle into scene. */ IEnumerator DownloadCacheInstantiate(int sibIndex, int pageNumber) { // Wait for the Caching system to be ready while (!Caching.ready) { yield return(null); } // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache using (WWW www = WWW.LoadFromCacheOrDownload(_url + _bookChoices + "-" + pageNumber, pageNumber)){ yield return(www); if (www.error != null) { throw new Exception("WWW download had an error:" + www.error); } // Get desired gameobject AssetBundle bundle = www.assetBundle; Debug.Log(bundle.Equals(null)); string str = pageNumber.ToString(); GameObject loaded = bundle.LoadAsset <GameObject>(str); // Place gameobject in scene GameObject page = Instantiate(loaded, BookInterface.transform.position, BookInterface.transform.rotation); page.transform.parent = Parent.transform; page.transform.Rotate(0, 180, 0); if (pageNumber == _currentPage) { page.SetActive(true); } else { page.SetActive(false); } // Update sibling index if (sibIndex != -1) { page.transform.SetSiblingIndex(sibIndex); } // Unload bundle bundle.Unload(false); } }