I am trying to integrate it to cloud example. In order to get bundles for each image target from cloud. Here is the code from this link https://developer.vuforia.com/forum/faq/unity-how-can-i-augment-my-image-target-model
using System; using UnityEngine; using System.Collections; public class AssetBundleAugmenter : MonoBehaviour, ITrackableEventHandler { public string AssetName; public int Version; private GameObject mBundleInstance = null; private string bundleLink; private TrackableBehaviour mTrackableBehaviour; private bool mAttached = false; void Start() { StartCoroutine(DownloadAndCache()); mTrackableBehaviour = GetComponent<TrackableBehaviour>(); if (mTrackableBehaviour) { mTrackableBehaviour.RegisterTrackableEventHandler(this); } } // Update is called once per frame IEnumerator DownloadAndCache() { while(!Caching.ready) yield return null; // to get the metadata as bundleURL if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED) bundleLink = TargetFinder.targetSearchResult.MetaData; // example URL of file on PC filesystem (Windows) //string bundleURL = "file:///D:/Unity/AssetBundles/MyAssetBundle.unity3d"; string bundleURL = bundleLink; // example URL of file on Android device SD-card using (WWW www = WWW.LoadFromCacheOrDownload(bundleURL, Version)) { yield return www; if (www.error != null) throw new Exception("WWW download had an error:" + www.error); AssetBundle bundle = www.assetBundle; if (AssetName == "") { mBundleInstance = Instantiate (bundle.mainAsset) as GameObject; } else { mBundleInstance = Instantiate(bundle.Load (AssetName)) as GameObject; } } } public void OnTrackableStateChanged( TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED) { 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; } } } }
But this code gives an error as below
Assets/Qualcomm Augmented Reality/Scripts/AssetBundleAugmenter.cs(32,21): error CS0103: The name `newStatus' does not exist in the current context
Assets/Qualcomm Augmented Reality/Scripts/AssetBundleAugmenter.cs(34,51): error CS0117: `TargetFinder' does not contain a definition for `targetSearchResult'
Should I do this metadata part in CloudRecoEventHandler.cs? I simply need to try to get each metadata info and use it as assetbundle link and downlad the asset bundle to corresponding image target.
Thanks in advance!
Thanks but when I pulled that out there is still the same error. I am uploading a screenshot, it gives error on the paranthesis. I look up the problem and it is caused sometimes because of a copy paste problem (character encoding) but I deleted and written all of the raw myself and still the same.