By wml123
on Fri, 11/16/2018 - 10:01
Hello! I'm currently trying to load a dataset from Application.persistentDataPath however I can't figure out why it doesn't work.
What I tried right now: 1. Created a new project
2. Enabled vuforia in player settings
3. Added an ar camera
4. Created a new script with the following content and attached it to a empty gameobject:
public class VuforiaLoader : MonoBehaviour { void Start () { VuforiaARController.Instance.RegisterVuforiaStartedCallback(LoadDataSet); } private void LoadDataSet() { ObjectTracker objectTracer = TrackerManager.Instance.GetTracker<ObjectTracker>(); DataSet dataSet = objectTracer.CreateDataSet(); var path = Application.persistentDataPath + "/Vuforia/" + "Spheres.xml"; var type = VuforiaUnity.StorageType.STORAGE_ABSOLUTE; Debug.Log("Loading dataset " + path); if (!DataSet.Exists(path, type)) { Debug.LogError("<color=blue>Data set doesn't exist</color>"); return; } else { Debug.LogError("<color=orange>Data set exists</color>"); } if (!dataSet.Load(path, type)) { Debug.LogError("Couldn't load dataset"); return; } objectTracer.Stop(); if (!objectTracer.ActivateDataSet(dataSet)) { Debug.LogError("Failed to activate dataset"); return; } if (!objectTracer.Start()) { Debug.LogError("Failed to start tracker"); return; } } }
5. Created a Image Target Database with 2 Targets in it called "Spheres"
6. Put the two files to C:\Users\user\AppData\LocalLow\DefaultCompany\VuforiaTests\Vuforia Spheres.xml and Spheres.dat
7. Ran the project
Result:
According to DataSet.Exists() the dataset exists, but dataSet.Load() isn't able to load the DataSet. Could somebody help?
Hello,
Hello,
Have you reviewed the following article?
https://library.vuforia.com/articles/Solution/Working-with-Vuforia-and-Unity.html
Thanks,
Vuforia Engine Support
Hello!
Hello!
Yes I did!
The targets load wonderfully when I put them into Assets/StreamingAssets/Vuforia.
I've also looked around on
I've also looked around on the forum and googled quite a bit and tried out lots of different solutions to this problem.
For example I found this link: https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/loading-datasets-external-scources
Alright I fixed it.
Alright I fixed it.
Problem was that I didn't use a key and thought (in dev player) that it'd work without one as well since it didn't give me an error message that it's missing one.