Hey there!
I'm really stuck and need your help asap because I've to submit my project in two days.
I used the following code and when I tried running it, it states "Cloud Reco is not available without a valid license. UnityEngine.Debug:LogError(Object)"
Please let me know how to fix it.
Here's my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
using UnityEngine.Video;
public class SimpleCloudHandler : MonoBehaviour, ICloudRecoEventHandler {
public ImageTargetBehaviour behaviour;
private CloudRecoBehaviour Cloud;
public GameObject MainPlayer;
public void OnInitError(TargetFinder.InitState initError)
{
throw new System.NotImplementedException();
}
public void OnInitialized()
{
throw new System.NotImplementedException();
}
public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
{
GameObject newImageTarget = Instantiate(behaviour.gameObject) as GameObject;
MainPlayer = newImageTarget.transform.GetChild(0).gameObject;
GameObject augmentation = null;
if(augmentation != null)
{
augmentation.transform.SetParent(newImageTarget.transform);
}
if(behaviour)
{
ObjectTracker tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
ImageTargetBehaviour imageTargetBehaviour = (ImageTargetBehaviour)tracker.TargetFinder.EnableTracking(targetSearchResult, newImageTarget);
string URL = targetSearchResult.MetaData;
MainPlayer.GetComponent<VideoPlayer>().url = URL.Trim();
Cloud.CloudRecoEnabled = true;
}
}
public void OnStateChanged(bool scanning)
{
if(scanning)
{
ObjectTracker tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
tracker.TargetFinder.ClearTrackables(false);
}
}
public void OnUpdateError(TargetFinder.UpdateState updateError)
{
throw new System.NotImplementedException();
}
// Use this for initialization
void Start () {
CloudRecoBehaviour cloudReco = GetComponent<CloudRecoBehaviour>();
if(cloudReco)
{
cloudReco.RegisterEventHandler(this);
}
Cloud = cloudReco;
MainPlayer = GameObject.Find("Player");
Hide(MainPlayer);
}
// Update is called once per frame
void Hide (GameObject obj) {
Renderer[] rends = obj.GetComponentsInChildren<Renderer>();
Collider[] cols = obj.GetComponentsInChildren<Collider>();
foreach(var item in rends)
{
item.enabled = false;
}
foreach(var item in cols)
{
item.enabled = false;
}
}
}
Hey Vinicius,
Would you be able to private message me your key so that I can try it locally and see if I get the error?
Thanks,
-Vuforia Support