Log in or register to post comments

Adding Datasets at runtime

February 26, 2018 - 9:24am #1

Hello, everyone.

I would like to know if there is any current way to add new Dataset from external/internal sources to application at runtime via c# script.

Adding Datasets at runtime

February 28, 2018 - 1:02am #3

Thanks. :D ;D

Adding Datasets at runtime

February 27, 2018 - 11:21am #2

Hello alexandermushta,

Yes, you can certainly activate a new dataset that you've downloaded or otherwise pulled into your app by some other means with a script. The following is an example function that will stop the tracker, load and activate the dataset, and then start the tracker again. This function assumes that you have downloaded your dataset and placed it in the StreamingAssets folder within your Unity project.

public void LoadAndActivateTarget(string datasetToLoad)
    {
        ObjectTracker objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
        objectTracker.Stop();


        DataSet dataset = objectTracker.CreateDataSet();

        if( DataSet.Exists( datasetToLoad ) )
        {
            dataset.Load( datasetToLoad );
            objectTracker.ActivateDataSet( dataset );
        }
        objectTracker.Start();
    }

Thanks,

Vuforia Support

Log in or register to post comments