Log in or register to post comments

Accessing database from scripts

June 22, 2021 - 11:11am #1

Accessing Vuforia Image database from scripts

I have been trying to change the Image Target at runtime, and I would like to find out if there is a way to access the imported Vuforia image database via scripts.

I tried the GetComponent method but it is giving me no results. What I am trying to do is access the database from a script and changing the image target at runtime.

I was hoping to get some answers here as there is little to no documentation of the Vuforia library used in Unity.

Accessing database from scripts

June 24, 2021 - 5:02am #3

I tested it - it will work but some of the  properties are read only  and you can change only the properties of the behaviour script where you could find  predefined methods


void Start()


        GameObject scriptObject = GameObject.FindWithTag("ImageTarget");


        if (scriptObject  == null)


            print("No object found with that tag Image Target!");




            print("someObject name: " + scriptObject.name);

            ImageTargetBehaviour behObj=scriptObject.GetComponent<ImageTargetBehaviour>();

            print("behObj.TrackableName=" + behObj.TrackableName);





So when we list the methods of the ImageTargetBehaviouir object:

e.g. we can change the hight or width  e.g. hight to 3f etc

We can see that some property are read only but vor changing other properties - ImageTarget property seems to be read only and I did not found a method to change it.


Vuforia Engine Support

Accessing database from scripts

June 23, 2021 - 5:26am #2


I want to refer to the How to "Create and Load Targets in Unity" article form the PTC developer portal

Especially you can check the following article point:

How to create Instant Image Targets at Runtime from a file or Texture2D Objects

Where two examples are provided which shows how to crate at runtime  image target from local file and from web URL

So this info could be an alternative techniques to your goal

There is also an info about loading of dynamic database.

If I understand correctly your goal  to use a database where are defined many image targets and you want to change the Image Target Behavior Script  - the global variable Image Target to the to specific  image target contained by the database definition, right?

I will check if this will work.

Another question is what is the goal there . Because you will have still the same augmentation for the image targets so means you need if it work  with the setting of different image targets you need also to adapt the augmentation


Log in or register to post comments