Hi!
In my project I'm trying to edit my multi targets XML file to move targets around in runtime. However, since the streamingassets path is read only i need to store the xml in the persistentDataPath and load the data set from there, but I'm having no luck with that at the moment. This is the code I use now:
public void LoadAndActivateDataset(string loadThisDataset, ObjectTracker objectTracker)
{ TrackerManager trackerManager = (TrackerManager)TrackerManager.Instance;
objectTracker.Stop();
//Create a new dataset object. DataSet dataset = objectTracker.CreateDataSet(); //Load and activate the dataset if it exists if (DataSet.Exists(loadThisDataset, VuforiaUnity.StorageType.STORAGE_ABSOLUTE)) {
if (!dataset.Load(loadThisDataset, VuforiaUnity.StorageType.STORAGE_ABSOLUTE)) { Debug.LogError("Fail to load"); } if (!objectTracker.ActivateDataSet(dataset)) { // Note: ImageTracker cannot have more than 100 total targets activated Debug.LogError("Failed to activate dataset"); }
}
objectTracker.Start(); }
loadThisDataset is the path to my xml file, i.e, Path.Combine(Application.persistentDataPath, "Warehouse.xml").
The message I get in the console from dataset.Load(loadThisDataset, VuforiaUnity.StorageType.STORAGE_ABSOLUTE) is:
Creating Multi Target with values:
ID: 1 Name: WarehouseImages Path: C:/x/MSI/AppData/LocalLow/x/x/Warehouse.xml
And all that's happening is one game object being created with the Multi Target behaviour component but the Warehouse database is not found.
How am I doing this wrong, have I not understood how to work with datasets perhaps? I thought simply loading the xml would find my database and instantiate the multi target.
Any help would be greatly apprectiated!
Thanks
Hello,
Hello,
[quote=hassehans]
loadThisDataset is the path to my xml file, i.e, Path.Combine(Application.persistentDataPath, "Warehouse.xml").
[/quote]
I'll assume that the DAT file is also in the same path. I believe this is confirmed by the logging message below.
Hi medabit, sorry for the
Hi medabit, sorry for the slow reply.
[quote=medabit]
I'll assume that the DAT file is also in the same path. I believe this is confirmed by the logging message below.
[/quote]
Hello,
Hello,
[quote=hassehans]
Well, simply that both the Database and Multi Target dropdowns in the Multi Target Behaviour component says ---Empty---, and I can't see Warehouse under Database or WarehouseImages under Multitarget.
Hi,
Hi,
[quote=medabit]
Hello,
Hello,
[quote=hassehans]