Log in or register to post comments

Vuforia with AssetBundle

September 18, 2017 - 11:21pm #1

Hi,

 

I want to dynamically matching target image with 3d model using Vuforia and Unity AssetBundle.

by having API that declared assetBundle url / matching list between image target and output 3d model (which may both inside that assetbundle).

Application will check and preload any assetbundle required by that API and can detected target at runtime.

 

But I'm not sure on how to bundle Device Database in assetbundle and make Vuforia SDK detected it at runtime?

 

Is there any basic guide on how to accomplish this kind of task ?

Thank you,

Vuforia with AssetBundle

October 12, 2020 - 3:21pm #6

I am using latest vuforia 9.4.6 with. 2019.3.5 editor but that solution didnt work because  DefaultTrackableEventHandler script resets itself when editor opens.

 

So what i did is:

tb.gameObject.GetComponent<DefaultTrackableEventHandler>().OnTargetLost = new UnityEngine.Events.UnityEvent();

      tb.gameObject.GetComponent<DefaultTrackableEventHandler>().OnTargetFound = new UnityEngine.Events.UnityEvent();

in my script.

Vuforia with AssetBundle

October 12, 2020 - 2:46pm #5

xebuddha wrote:

I solved the issue with changing code in DefaultTrackableEventHandler script



from

public UnityEvent OnTargetFound;

public UnityEvent OnTargetLost;

 

to

 

public UnityEvent OnTargetFound = new UnityEvent();

public UnityEvent OnTargetLost = new UnityEvent();

Excuse me what version of vuforia are you using? i have a problem update remotely targets.

Vuforia with AssetBundle

October 12, 2020 - 7:47am #4

I solved the issue with changing code in DefaultTrackableEventHandler script



from

public UnityEvent OnTargetFound;

public UnityEvent OnTargetLost;

 

to

 

public UnityEvent OnTargetFound = new UnityEvent();

public UnityEvent OnTargetLost = new UnityEvent();

Vuforia with AssetBundle

October 12, 2020 - 5:26am #3

Strasza wrote:

Hello Amefuri,

You can bundle the .dat and .xml file that are associated with your Device Database and load them at run time. This article provides some examples of how to load a database from the SD card: https://library.vuforia.com/articles/Solution/Working-with-Vuforia-and-Unity.html#load-dataset

This old post by dm3d has an example script of loading and activating a Device Database at runtime and then assigning it an augmentation: https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

Let me know if you have further questions on this topic.

Thanks,

-Vuforia Support

 

Thank you I have managed to solve most of my problems but there is one issue please help me:

 

Dynamic data set loader script: Loops TrackableBehaviour and adds them DefaultTrackableEventHandler script.

tb.gameObject.AddComponent<DefaultTrackableEventHandler>();

When i try to access that script with GetComponent, for OnTargetFound event, it gives null exception:

tb.gameObject.GetComponent<DefaultTrackableEventHandler>().OnTargetFound.AddListener(CarFound); is giving null exception

tb.gameObject.GetComponent<DefaultTrackableEventHandler>().OnTargetFound.RemoveAllListeners(); is giving null exception

I can reach DefaultTrackableEventHandler component but cant do anything with it.

DefaultTrackableEventHandler dteh = tb.gameObject.GetComponent<DefaultTrackableEventHandler>(); is NOT giving null exception

b.gameObject.GetComponent<DefaultTrackableEventHandler>().enabled = false; is working as well

 

void CarFound()

    {

  augmentation.SetActive(true);

}

Please help me

Vuforia with AssetBundle

September 19, 2017 - 9:55am #2

Hello Amefuri,

You can bundle the .dat and .xml file that are associated with your Device Database and load them at run time. This article provides some examples of how to load a database from the SD card: https://library.vuforia.com/articles/Solution/Working-with-Vuforia-and-Unity.html#load-dataset

This old post by dm3d has an example script of loading and activating a Device Database at runtime and then assigning it an augmentation: https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

Let me know if you have further questions on this topic.

Thanks,

-Vuforia Support

Log in or register to post comments