Search Unity

Loading a dataset at runtime from persistent data (into assetbundle streamed scene)

Discussion in 'Vuforia' started by nilsdr, May 7, 2018.

  1. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    374
    Hi @Vuforia-Strasza @vuforia-dcordero and others,

    For a bunch of our apps we combine the use of image targets and scenes from assetbundles. Basicaly, we want to add new streamed scene to a deployed applications and do so by using assetbundles. This creates a problem however, as the image target databse has to be in streaming assets and can therefor not be in the assetbundle. Currently we solve this by downloading the dataset to persistent storage and loading it / assigning trackables at runtime (like so https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime)

    This technique works fine but overcomplicates our workflow, as it prevents us from simply creating image targets / dropping gameobjects on them in the editor. We have to write custom code to deal with scaling etc. etc.

    Recently, I ran into the split OBB problem (this one https://developer.vuforia.com/forum/faq/load-dataset-android-split-binary-obb). Basicaly, if an APK is split into apk and OBB because its larger than 100mb, on android vuforia won't find the database because it's compressed into the obb. To solve this, theres a script which before initializing Vuforia writes these files to the persistent data path + "/QCAR" (I've seen this refered to as Vuforia's extended root) and Vuforia can then find it as if it were loaded the regular way from streaming assets.

    So then I thought, I have a solution to our problem now, I can just put regular image targets in a scene and make sure the database is downloaded to the extended root, and vuforia will them find them. This doesn't appear to be the case, vuforia doesn't seem aware of the dataset even if its in persistent data path + "/QCAR", so no luck there.

    Why is this happening? Is it because the dataset wasn't present at build time? If we could somehow add image targets at runtime without having to write custom code it would really simplify our workflow.
     
  2. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    374
  3. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    374
    @Vuforia-Strasza any way I can ask for support on this? We purchase dozens of licenses each year, was hoping to be able to get an answer to this somehow.
     
  4. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Hi @nilsdr

    You need to dataset present in the project in order to set up the target + augmentation within the Unity Editor. In your case where you have the dataset stored externally, dynamically loading these and setting them up via code is your only option. Something I can recommend is to pull these datasets into Unity separately and determine your augmentation, scale, etc. and then store this data in some capacity. This way you can download your dataset and this additional data to easily setup your targets dynamically in code.

    The OBB post you are referencing is purely a solution for an Android split APK. In this instance, the datasets do exists within the project, but the process of creating the OBB moves them to a new location. The script in that post provides a means to put them back in the correct location. This will not address the problem you are trying to solve.
     
  5. buganamo

    buganamo

    Joined:
    Nov 12, 2018
    Posts:
    1
    Would it be possible to bring your database into Unity, setup a target, then create an AssetBundle from the configured target, model, and database? I am trying to build a Unity app that acts like a container/viewer. I was hoping to be able to have it contact the server for a list of available AssetBundles, download the bundle, and use the Vuforia database and targets that were downloaded with the AssetBundle.

    Is this possible?
     
    swapnilcomXR and adrienalltech like this.