Log in or register to post comments

TrackerManager.Instance.GetTracker<objecttracker>() is null.

March 15, 2017 - 1:38am #1

Hello,

I have tried this https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

and it gives me error. I saw many people that have this problem and none of them got solution.

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object

 

The line that breaks is ( the forum adds closing </objectracker> tag automatically ):

 

ObjectTracker objectTracker = TrackerManager.Instance.GetTracker();

 

Here is the entire code:

 

using UnityEngine;
using System.Collections;

using Vuforia;
using System.Collections.Generic;


public class DynamicDataSetLoader : MonoBehaviour
{
    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(LoadDataSet);
    }

    void LoadDataSet()
    {

        ObjectTracker objectTracker = TrackerManager.Instance.GetTracker();
        DataSet dataSet = objectTracker.CreateDataSet();
    }
}

 

TrackerManager.Instance.GetTracker() is null.

June 30, 2017 - 2:54am #9

Hello, I got the black screen problem too. Here the debug from XCode. (Unity 5.3.5, Vuforia 6.2.9, Xcode 8.2.1)

///////////////////

Initializing Vuforia...

2017-06-29 19:00:02.025 osjaar[14038:5937414] INFO/AR(14038) 2017-06-30 19:00:02: Vuforia selected rendering API Metal

2017-06-29 19:00:02.026 osjaar[14038:5937414] INFO/AR(14038) 2017-06-30 19:00:02: Vuforia SDK version 6.2.9

2017-06-29 19:00:02.113 osjaar[14038:5937414] Rendering mode set to: Metal

2017-06-29 19:00:02.255 osjaar[14038:5937414] Rendering mode set to: Metal

2017-06-29 19:00:02.257 osjaar[14038:5937414] DEBUG/AR(14038) Could not find a UIView with CAEAGLLayer or CAMetalLayer layer class that responds to selector renderFrameVuforia



Vuforia initialization successful

Vuforia.VuforiaRuntime:InitVuforia()

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException:

  at Vuforia.VuforiaARController.Start () [0x00000] in <filename unknown>:0

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

  at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in <filename unknown>:0

  --- End of inner exception stack trace ---

  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

  at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in <filename unknown>:0

Vuforia.DelegateHelper:InvokeDelegate(Delegate, Object[])

///////////////////

TrackerManager.Instance.GetTracker() is null.

June 30, 2017 - 1:37am #8

Hi Strasza,

 

Yes my code actually worked flawlessly with 5.5.9.

And this issue just appeared while reusing the same code on a new project with Vuforia 6.2.10

I just changed the callbacks to correspond to the new classes.

 

Anyway, I deleted all plugins files and reimported them.

I still get the error in the editor, but most importantly it seems to work on Android.

 

I don't get what happened or changed though... 

Thanks for your quick response anyway :)

TrackerManager.Instance.GetTracker() is null.

June 29, 2017 - 10:21am #7

Hello all,

I was able to successfully get an ObjectTracker object using the code seen in the link provided in a previous comment.

With the following code on a Monobehavior, I successfully got a non-null ObjectTracker object:

void Start()
{
    VuforiaARController.Instance.RegisterVuforiaStartedCallback(GetObjectTracker);
}

void GetObjectTracker()
{
    ObjectTracker objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
}

When you try to get an ObjectTracker from the TrackerManager, have you ensured it is after the VuforiaStartedCallback has been fired?

Thanks.

TrackerManager.Instance.GetTracker() is null.

June 29, 2017 - 8:44am #6

Bump.

This is still an issue. 

 

Our code worked fine for Vuforia 5.5.9.

It seems since 6.1 or 6.2 we had to change the callbacks, which we did (currently at the latest v6.2.10).

But the currently still documented TrackerManager.Instance.GetTracker<ObjectTracker>() always returns null;

Not just for ObjectTracker, but for any tracker you put in there.

So there is no way for us to manage the datasets, handle extended tracking, initialize the trackers with the needed scripts or load datasets dynamically.

 

Any ways around this?

Stuff that changed that wasn't reflected on the documentation maybe?

Could anyone from Vuforia comment on this?

 

Thanks !

TrackerManager.Instance.GetTracker() is null.

June 8, 2017 - 3:12am #5

Hello,

I have exactly the same issue...

although I've followed the example given here:

https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

it's giving me an error:

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object

 

is there any solution for this?

 

TrackerManager.Instance.GetTracker() is null.

May 23, 2017 - 4:02am #4

Hey, I'm having a problem like this.

My code gives me an error like this:

Type `UnityEngine.GameObject' does not contain a definition for `GetTracker' and no extension method `GetTracker' of type `UnityEngine.GameObject' could be found.

Has anyone found a solution? I can't find it anywhere.

TrackerManager.Instance.GetTracker() is null.

March 23, 2017 - 1:42pm #3

I updated the FAQ script for Vuforia 6.1 not long ago, but if you're using 6.2, you'll need to use VuforiaARController.RegisterVuforiaStartedCallback().

https://library.vuforia.com/reference/api/unity/classVuforia_1_1VuforiaARController.html

TrackerManager.Instance.GetTracker() is null.

March 19, 2017 - 1:00pm #2

I'm having the same issue. Is there anyone who was able to solve this issue of the object tracker returning null?

Log in or register to post comments