Log in or register to post comments

Download and active database runtime

March 15, 2018 - 5:16am #1

Hello,

I'm making Hololens App that download vuforia database and print it in a GameObject on the scene. in the editor it works fine but when i run the app on Hololens it doesn't work i think the problem is with the path that im using to download de database i paste here some pieces of code

to show how im doing the downlaod

First i download the files in a script called LoadDatas

IEnumerator GetXML()

    {

        WWW www = new WWW(url);

        yield return www;

        //  var XML = www.text;

        System.IO.File.WriteAllBytes(Application.streamingAssetsPath + "/Vuforia/150.xml", www.bytes);

       

    }IEnumerator GetDAT()

    {

        WWW www = new WWW(url);

        yield return www;

        System.IO.File.WriteAllBytes(Application.streamingAssetsPath + "/Vuforia/150.dat", www.bytes);

    }

Then in other script called LoaderDataSet print the object and more

void LoadDataSet()

    {

    

        objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>();

        dataSet = objectTracker.CreateDataSet();

      

        if (dataSet.Load(dataSetName))

        {

           

            objectTracker.Stop();  // stop tracker so that we can add new dataset

            if (!objectTracker.ActivateDataSet(dataSet))

            {

                // Note: ImageTracker cannot have more than 100 total targets activated

                Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>");

            }

            if (!objectTracker.Start())

            {

                Debug.Log("<color=yellow>Tracker Failed to Start.</color>");

            }

            int counter = 0;

            IEnumerable<TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours();

            foreach (TrackableBehaviour tb in tbs)

            {

            

                if (tb.name == "New Game Object")

                {

                    // change generic name to include trackable name

                    tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName;

                    // add additional script components for trackable

                    tb.gameObject.AddComponent<DefaultTrackableEventHandler>();

                    tb.gameObject.AddComponent<TurnOffBehaviour>();

                    if (augmentationObject != null)

                    {

                        // instantiate augmentation object and parent to trackable

                        GameObject augmentation = (GameObject)GameObject.Instantiate(augmentationObject);

                        augmentation.transform.parent = tb.gameObject.transform;

                        augmentation.transform.localPosition = new Vector3(0f, 0f, 0f);

                        augmentation.transform.localRotation = Quaternion.identity;

                        augmentation.transform.localScale = new Vector3(1f, 1f, 1f);

                        augmentation.gameObject.SetActive(true);

                    }

                    else

                    {

                        Debug.Log("<color=yellow>Warning: No augmentation object specified for: " + tb.TrackableName + "</color>");

                    }

                }

            }

        }

        else

        {

            Debug.LogError("<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>");

        }

    }

 

Thanks in advance!

 

 

 

Download and active database runtime

March 19, 2018 - 1:18am #2

Can you give us more details about the error?

Your problem may be related to WWW lastest bug, which return error and content null in any case, please check if that is happening to you.

Log in or register to post comments