- Sort Posts
- 4 replies
- Last post
imageTracker.GetActiveDataSets() returns 0 elements
I think that perhaps you may be accessing it incorrectly?
Just now I was able to extend the Image Targets sample to enumerate through the list of active datasets by adding the method below to ImageTargetTrackableEventHandler.cs:
void Update ()
{
ImageTracker imageTracker = TrackerManager.Instance.GetTracker<ImageTracker>();
if (imageTracker != null)
{
IEnumerable<DataSet> activeDataSets = imageTracker.GetActiveDataSets();
foreach (DataSet ds in activeDataSets) {
Debug.Log("Active dataset = " + ds.Path);
}
}
}
Remember that the IEnumerable returns just an enumerator type in C# http://msdn.microsoft.com/en-us/library/system.collections.ienumerable(v=vs.110).aspx
... which means that it in itself is not a list from which you can get a count. Instead you get an enumerator which allows you to iterate through, and in the above example it simply prints the following:
"Active dataset = QCAR/StonesAndChips.xml"
HTH
N
imageTracker.GetActiveDataSets() returns 0 elements
I'm developping and Android Unity application. It occurs in Play mode and device. In my case I have 3 DataSets loaded but only one activated. When I invoke "GetActiveDataSets()" from ImagetTracker, I get a IEnumerable that I convert into a list that contains 0 elements. How is it possible if I have in my Editor one activated DataSet
Hello
You can only activate a dataset if the tracker is stopped.
Therefore you need to stop the tracker before activating a DataSet.
Otherwise, the DataSet won't be part of the collection in the code
IEnumerable<DataSet> activeDataSets = oTracker.GetActiveDataSets();