AR foundation: when phone camera is covered, instantiated object is glued to the camera

I downloaded the AR Foundation samples from Unity, and made a build of one of the scenes called ImageTrackingWithMultiplePrefabs and put it on my android phone.

The build works fine when scanning markers, but as soon as the camera is covered, the object is glued to the camera, and I have to either look at the marker again, or restart the app to fix it.
This is going to be an issue because we’re making an app and it could happen a lot, for example when the user puts their phone down.

I made a video to better explain the issue:

More info:
Unity version: 2020.3.20f1
AR Foundation version: 4.1.9
phone: google pixel 5 (but it also happened on my Samsung galaxy S10)

I put a log in the PrefabPairImageManager.cs script and noticed that when we look away, the tracking changes to limited, and stays the same, even when the camera is covered. So there’s no way for me to find out when the camera is covered in code based on the tracking info.

What am I doing wrong?
Thanks a lot

You should hide your object when the image tracking state for the ARTrackedImage.trackingState and hide your game object when the tracking state is not TrackingState.Tracking.
https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.ARTrackable-2.html#UnityEngine_XR_ARFoundation_ARTrackable_2_trackingState

In your video, the issue is also occurring with the cube. However, in the case of the cube, the center of the cube is attached to the eye, and thus, you are looking at the backfaces of the cube which do not get rendered.

hey thanks for the response, but I don’t want to hide it… I want it to stay there so users can go far and still see them. This was possible in previous versions, not to destroy the object when tracking is gone, so I wanna do the same here.

The behavior comes from the platform SDK, Google ARCore in your case.