Image Tracking not working when deploying to device

Hi there!

We are currently attempting to integrate an Image Tracking use case into our app and have run into an issue where a reference image is not being tracked correctly.

Once an image is recognised, a virtual UI is placed over it. This works perfectly when testing in Unity and with Play To Device, but as soon as we build the app and run it on device, the image is not recognised and thus, no UI is displayed.

We are not sure whether this is a visionOS issue, if something is getting lost during the build process or if we are missing a setting we need to apply.

We are on visionOS 2.1, Unity 6000.0.23f1 and PolySpatial 2.0.4 and using Xcode 16.0 to deploy to device.

Is there something we are missing?

EDIT: We are observing the same issue with the PolySpatial Image Tracking Sample Project

Check in the console if it prints that there is no Image Tracking subsystem available in XCode.

We’re not seeing any image tracking warnings or errors in the console.

It does look like image tracking is being initialised correctly though, as we did see a message saying “Image tracking provider started”

Do you have the physical size set? If you put a prefab into the ARTrackedImageManager, do you see it on the image?

After testing with a different prefab in the ARTrakedImageManager we noticed that this issue only seems to affect UI elements (Canvas).
Placing e.g. a sphere at the location of the tracked image works as expected in the build. Only UI elements are not displayed.

Is this a known issue or is there a solution to this?

Ok so we found the root cause and the solution:

In Unity, each reference image is given a name (e.g. “image1”). We are using this name to instantiate prefabs that correspond to a specific image. In Play To Device, this works fine.
However, during the build process, the names of reference images are changed to include a GUID. So “image1” becomes e.g. “image1_6E34_23FD_210E_ABCD”. This breaks our system so that no prefabs are instantiated, because the name check fails.

To fix this issue, the name cannot be used as an identifier to instantiate prefabs based on images.

Note: The Guid an image receives in Unity and the Guid assigned by Xcode are not the same, so it is not possible to simply concatenate the guid to the name in code.

Could a member of Unity staff clarify if this is intended behaviour?

Just use Contains instead of equality

Yes, we are now using StartsWith instead of Equals, which works as a workaround, but hardly seems like an optimal solution looking forward.