Unity-Technologies / arfoundation-samples

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

[Bug] ARTrackedImageManager OnTrackedChanged event does not fire if a new image is detected before the previous image was lost #1027

Closed SimonDarksideJ closed 1 year ago

SimonDarksideJ commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

When tracking multiple cards, the following behaviour exists:

Essentially, if a new card is detected in roughly the same location before the previous cards tracking state it updated, BOTH tracked images are incorrectly left set as being tracked, essentially the second cards tracking state overwrites the first cards state.

To Reproduce Steps to reproduce the behavior:

  1. Use the ARfoundation Image Tracking sample scene, making sure separate content is rendered for the two sample images
  2. Deploy the application to a device
  3. Browse to the first card on a screen (easiest way rather than printing lots of cards out) and have the application detect and render content
  4. Change the image on screen whilst holding the device steady, to the second image

Expected behavior

The tracking state for the first card should send an updated state with tracking lost (ideally it should also send a Lost state, but that isn't working) BEFORE the tracking event for the newly detected card is sent

Actual behavior

The new tracking state for the newly detected card is sent, NOT sending a changed or removed event for the first card, thus showing two sets of content active on the newly detected card.

Smartphone (please complete the following information):

andyb-unity commented 1 year ago

The AR Tracked Image Manager (like all managers in AR Foundation) makes no determination of whether images are added, updated, or removed. It receives these events from the image tracking subsystem provider for your platform (ARKit on iOS and ARCore on Android).

We have also observed this issue with stacked images (especially digital images), but this is a case of AR Foundation correctly reporting the information it receives from the platform.

To report this issue to Apple and Google:

SimonDarksideJ commented 1 year ago

Thanks for the prompt response @andyb-unity , can we get this information added to the Known issues on the readme for these samples so it doesn't trip other developers up, then close this issue.

Just confirmed with a simple test that when this occurs, both the visible and invisible trackables are still marked as "Tracked", so there is little that can be done from an ARFoundation perspective.

andyb-unity commented 1 year ago

It's a good thought, but Unity doesn't maintain documentation of known issues in any of our partners' tools. I've made a note to see if we can find a way to work this into image tracking documentation.

tdmowrer commented 1 year ago

I don't know that this is a "known issue". It's just the expected behavior. There is already a note in the docs that addresses this particular point:

Determining when an image is visible