"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Deactivate/Activate Datasets for Model target

Hi I am using Unity 2017.3.1f1 and latest Vuforia with it.

I am trying to understand Model Target but the documenation I find and posts are all not up to date or just doesn't have my issue described.

I have 3 model targets (which will be many more if this succeeds)

Now, it doesn't seem to work to load 3 model target databases and have them activated since vuforia will throw "Could not activate dataset" on every dataset except the first. I then tried to only activate any 1 of them first and not click in "activate" on the other 2. This worked.

But then when I try to deactivate one dataset and activate the next I always get the same error (could not activate/deactivate dataset)

How on earth should I write code to change the activated dataset in runtime?

I have tried to do something like this;

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

        IEnumerable<DataSet> dataSets = objectTracker.GetDataSets();

        int index = 0;

        DataSet activeDataSet = null;

        foreach(DataSet ds in dataSets)         {             if(index == currentIndex)             {                 activeDataSet = ds;

break;             }             else             {                 index++;             }         }         objectTracker.Stop();         objectTracker.DeactivateDataSet(activeDataSet);

        models[currentIndex].SetActive(false);

        currentIndex = (currentIndex + 1) % models.Length;

        activeDataSet = null;

        foreach (DataSet ds in dataSets)         {             if (index == currentIndex)             {                 activeDataSet = ds;

break;             }             else             {                 index++;             }         }

        objectTracker.ActivateDataSet(activeDataSet);         objectTracker.Start();

 

But this code does not work! I have tried many versions of the above code but none of them managed to do this. Please help me!

Hello ChoArrim,

The following function will disable all active datasets and then activate that dataset passed into the function. It will also set the Model Target activated to use a 2D GuideView.