Log in or register to post comments

Creating new ModelTarget in Script

SDK 10.0
November 10, 2021 - 4:55am #1

Hi,

I'm trying to create a new ModelTarget in a script. It is a basic Monobehaviour script and i would like to add a new ModelTarget in the start methode.

So i use following line of Code:

 

ModelTargetBehaviour modelTarget = VuforiaBehaviour.Instance.ObserverFactory.CreateModelTarget(Application.streamingAssetsPath + "/Vuforia/VuforiaMars_ModelTarget.xml", "VuforiaMars_ModelTarget");

 

As soon as i start the application e get the following runtime error:

 

NullReferenceException: Object reference not set to an instance of an object

Vuforia.Internal.Core.ObserverFactory.<CreateModelTargetObserver>g__CreateAndConfigureObserver|16_0 (Vuforia.Internal.Core.ObserverFactory+<>c__DisplayClass16_0& ) (at <35701e67ff8947509368888f581d5ed2>:0)

Vuforia.Internal.Core.ObserverFactory.CreateModelTargetObserver (System.String dataSetPath, System.String targetName, System.Nullable`1[T] trackingMode, System.Nullable`1[T] motionHint) (at <35701e67ff8947509368888f581d5ed2>:0)

Vuforia.ObserverFactory.CreateModelTarget (System.String databasePath, System.String targetName, System.Nullable`1[T] trackingMode, System.Nullable`1[T] motionHint) (at <35701e67ff8947509368888f581d5ed2>:0)

LOADDMT.Start () (at Assets/LOADDMT.cs:14)

 

Thanks for the help in advance :)

 

Followup question: This generated ModelTargetBehaviour Object should be attached to an gameobject which has a child(augmentation) to generate an augmentation?

SDK Version: 
Log in or register to post comments