Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.04k stars 1.14k forks source link

[Bug] TrackedImageInfoManager gets stuck in an endless ARTrackedImagesChangedEventArgs Updated loop #1025

Closed SimonDarksideJ closed 1 year ago

SimonDarksideJ commented 1 year ago

Unity bug report case number https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-23117

Describe the bug

In testing the ARFoundation-Samples Image tracking scenes, the Updated event for tracked images seems to get stuck and fires out continuously, even when the image is no longer available. Also, the "Removed" event update is never fired. This prevents other configured images from being detected.

There is an odd occasion when it does work as expected, but this is very infrequent.

To Reproduce Steps to reproduce the behavior:

  1. Open the arfoundation-samples project in Unity and install logcat
  2. Open the BasicImageTracking scene
  3. Add debug logging to the "Added" and "updated" checks in the OnTrackedImagesChanged method
  4. Run project on android device.
  5. See error

Expected behavior A clear and concise description of what you expected to happen. Occasionally the system will work as expected, the events will only fire when the image is detected and then the device / image are moved. But this is very infrequent.

Actual behavior A clear and concise description of what actually happened. The OnTrackedImagesChanged method is continually fired with an updated event once the image has been seen, and does not stop even when the image is no longer visible.

Smartphone (please complete the following information):

andyb-unity commented 1 year ago

Thanks for reporting these issues! They in the queue for our incoming QA team to triage, and we'll update this thread as we learn more.

andyb-unity commented 1 year ago

Hi @SimonDarksideJ,

I'm looking at this issue again, and it doesn't sound like anything is wrong to me? It is expected behavior that OnTrackedImagesChanged will contain a list of updated images, and images are expected to update every frame.

Note that the underlying platform implementation decides when to remove an image, and platforms rarely do this. It is more likely the image tracking state has been changed to "Limited", which you can check by reading the values of the trackables in the OnTrackedImagesChanged event.

From our docs:

Note that images also have a tracking state which can provide additional information about the tracking quality. An image that goes out of view, for example, might not be "removed", but its tracking state likely changes.

SimonDarksideJ commented 1 year ago

I'll close this issue as it actually pertains to ARCore and ARKit's image-tracking capabilities and not ARFoundation. But the issues and limitations of these platforms needs to be stated, else it leads to confusion and limited capabilities.

Personally, we are having to build up a framework to handle the limitations of the lack of "Tracking Lost", something ARFoundation implements but is not supported by any of the providers (giving a false sense of security). Plus several other issues related to the persistence of tracked content.