I am creating an augmented reality app using vuforia and unity. i have uploaded my assetbundle to firebase storage and i want to retrieve a 3d model saved inside it and load it as a child on my image target game object but it i cant retrieve it.i also installed firebase unity sdk.
using Firebase;
using Firebase.Storage;
using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using System;
using UnityEngine.Networking;
using UnityEngine.UI;
public class loadmodel2 : MonoBehaviour
{
public GameObject test;
void Start()
{
FirebaseStorage storage = FirebaseStorage.DefaultInstance;
Firebase.Storage.StorageReference reference =storage.GetReferenceFromUrl("gs://fit-union-221609.appspot.com/assettest1/myasset");
reference.GetDownloadUrlAsync().ContinueWith((Task<Uri> task) => {
if (!task.IsFaulted && !task.IsCanceled)
{
Debug.Log("Download URL: " + task.Result);
// ... now download the file via WWW or UnityWebRequest.
StartCoroutine(Loadcoroutine());
}
});
}
IEnumerator Loadcoroutine()
{
string url = "gs://fit-union-221609.appspot.com/assettest1/myasset";
WWW www = new WWW(url);
while (!www.isDone)
yield return null;
AssetBundle myasset = www.assetBundle;
GameObject mya1 = myasset.LoadAsset("Barbarian Variant") as GameObject;
Instantiate(mya1).transform.parent = test.transform;
}
}
i created a new asset bundle with the same name "myasset" and uploaded it to firebase storage ialso changed the name of the 3d model to "BarbarianVariant" removing the space
in here i have enabled loadmodel2 script in the main camera and for the test game object i assigned maincamera.you can also see the output i get in the console