Load Vuforia Targets from the Android App-specific storage in Unity¶
Vuforia Engine lets you load Vuforia targets from app-specific storage on Android. Dataset (.xml
and .dat
) files that are downloaded at runtime can be saved to that location and loaded using the following example.
Load from App-specific Storage¶
Unity provides an abstraction for app-specific storage, which is accessible using the persistentDataPath.
On most devices, the persistent datapath looks like this:
For example, if your package name is com.myorg.myapps
, you should see:
Based on the above information, you should store your dataset files in the above directory once they are downloaded. For example, for the VuforiaMars_Images
database, you should copy the dataset files into a subdirectory in /files/
or into the following directory:
The following code snippet shows how to load dataset files from the app-specific storage in a C# script. In the following example, the database is called VuforiaMars_Images
(dataset files VuforiaMars_Images.xml
and VuforiaMars_Images.dat
) and the target is called Astronaut
. The database was saved directly into UnityEngine.Application.persistentDataPath
: