Vuforia Image Target works in Unity Play Mode (Webcam) but no track on ML2 (and no errors)

Hi,

Could anyone give any suggestions? I'm attempting to track based on a picture I took (I've tried both PNG and JPG versions). On Unity in play mode (computer + webcam), the image target is tracked just fine.

However on the ML2 device, it seems to never be seen, regardless of lighting. There are no errors. All I see, once, is:

"Target status: redbicycleJPG NO_POSE - - NOT_OBSERVED"

Any suggestions on how to track down the issue would be most appreciated.

Thank you!

Vuforia Engine: 10.17.4
Unity Editor version: 2022.2.21f1
ML2 OS version: 1.3.0
MLSDK version: 1.9.0
Host OS: (Windows/MacOS) MacOS

Error messages from logs (syntax-highlighting is supported via Markdown):

Target status: redbicycleJPG NO_POSE - - NOT_OBSERVED
DefaultObserverEventHandler:OnObserverStatusChanged(ObserverBehaviour, TargetStatus)

I had a similar issue.
I could not get any Vuforia Tracking to work on the ML2.

But now - suddenly it started working - so what did I do?

Not entirely sure. I am running Unity 2022.3.5f1, I updated the MLSDK version from 1.6.1 (this one shipped with the ML2 Vuforia Sample Project) to 1.9.0.

It seems a permission problem - you can see, that the red recording indicator does not show when running the app - right?
I managed to fix that - seemingly - by making sure that I request the CAMERA and Spatial-Permissions again at runtime (see https://developer-docs.magicleap.cloud/docs/guides/unity/permissions/requesting-permissions)

Then I closed and started the app twice(!) because at each start, it seemingly requested another permission separately (first Spatial Anchors, later Camera)

Then I tried to set Vuforia Initialization to "delayed" in the configs, because I think the major issue is actually, that Vuforia initializes too fast on App start - but then it did not work at all, because I assume, you need to initialize it manually when setting it that way.

Anyhow - In the end it worked - so what I would recommend you trying:

Update to Unity 2022.3.5 (or 6)
Deactivate ARCore Library packaging in the Vuforia Config Settings under "Android Settings"
Update your OS to 1.4.dev(secure) (the most recent one)

I started giving up on debugging one by one yesterday, because it became increasingly frustrating to figure out, why a sample project just does not work, although it initializes everything without errors.
So - sorry - been there - but can only roughly hint you at possible issues.

Thank you for your reply. I tried these suggestions but unfortunately still no luck on my end. No tracking in the headset — tracking continues to work fine in Play mode.

The only error I do see right around the time of Vuforia init and report of no tracking is:

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

but it's completely unclear what is emitting that error.

I also tried requesting all the permissions at Runtime via a script attached to the Camera object before the Vuforia Behavior and use the "delayed" initialization and called "VuforiaApplication.Instance.Initialize();" to start it manually. But no luck.

Via ML2 Settings, I can see that my application does indeed have all the permissions it needs granted. But, you are correct, no little red light.

At least ML2's Aruco codes work for me to continue prototyping!

If anyone has insights on how to elucidate what's going on, it would be much appreciated!

Hello, perhaps you want to check out this post:
Vuforia works in one project but not another, no Camera permissions request - Vuforia Engine - Magic Leap 2 Developer Forums

Initializing Vuforia manually after granting the needed permission seems to be the fix.
Even tho you tried it in similar fashian, try again with the code provided in one of the answers, this is my way to go now to use Vuforia on the ML2.

Let me know if it fixes your problem.

Thank you that is a useful looking thread.
I tried that runtime permissions request approach... and have found something interesting. When using the delayed initialization of Vuforia, debug messages appear only before, but not after.

Debug.Log("Doing Delayed Initialize now!");  // This prints
VuforiaApplication.Instance.Initialize();   
Debug.Log("Delayed Initialize complete!");  // This does *not* print

Instead I see this error right after:

Doing Delayed Initialize now!
NullReferenceException: Object reference not set to an instance of an object.

I checked, the instance (VuforiaApplication.Instance) itself is not null.

  • Any way to find out what might be throwing that exception?
  • Which VuforiaBehavior dll should I be using as my "Script", the Managed Android one or the Managed Runtime one?
  • Should the runtime permissions / delayed manual initialization script (I have mine in the Camera object) come after the Vuforia Behavior or before it? (Maybe that doesn't matter?)

Thank you.

Does anyone have a working image target Unity project they'd be willing to share?

Hi, have you tried running the ML2 Unity Sample from scratch? It has Image targets: Vuforia Magic Leap 2 Sample | Packs | Unity Asset Store

Have had similar very issues with Vuforia not initializing on ML2 even on simple examples.