Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Detecting a removed image trackable again [5.0.6]

Discussion in 'AR' started by Dan4x8, May 23, 2023.

  1. Dan4x8

    Dan4x8

    Joined:
    Feb 27, 2015
    Posts:
    13
    Hello

    For short context/scenario:
    We have an AR session that occasionally uses image tracking to find anchor positions and place objects. Once properly anchored the image tracking is no longer required so we deactivate it as well as its trackables.
    There are certain points in our application were we require to level the field and fully reset the AR session.
    Since 5.0.6 this works mostly like a charm.

    The problem arises as soon as we re-activate the image tracker manager after a session reset. In this moment the tracking and its trackables get reactivated and the trackables get removed (this seems only to happen on Android, not on iOS).

    Once a image trackable is removed it seems to be impossible to get it added again. How can we add it again? We need sometimes to find an image again that was in use before the session reset and can't do so as the imagetracking manager refuses to send OnTrackedImageChanged events for trackables once removed.

    Additional Info:
    OnTrackedImageChanged fires for each removed trackable once with the trackable beeing in eventArgs.removed - even after multiple ARSession.Resets.
     
    KyryloKuzyk and Kordi1 like this.
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,065
    Last edited: May 24, 2023
  3. Dan4x8

    Dan4x8

    Joined:
    Feb 27, 2015
    Posts:
    13
    This is not about visibility. I can't check the state as there is no place where i could check it.
    After OnTrackedImagesChanges fires with them in eventArgs.removed the event never gets fired again. They are literally removed from the manager trackables after a session.reset.
     
    Last edited: May 24, 2023
    KyryloKuzyk likes this.
  4. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,065
    Sorry, I didn't give enough attention to the question.

    If it worked before 5.0.6 and now it doesn't, it may be a bug actually. So after the image removal event, the manager doesn't contain any images anymore and doesn't track images, right?
     
  5. Dan4x8

    Dan4x8

    Joined:
    Feb 27, 2015
    Posts:
    13
    Yes. They are not in the accessible manager trackables anymore and don't track at all/don't get recognized anymore.

    Interestingly if I track another image then (as expected that one gets recognized/tracked) and do another ARSession.Reset() the OnTrackedImagesChanged removed event fires twice, once for the first trackable and once for the second - so the manager has still to have some knowledge somewhere about them.
     
    KyryloKuzyk likes this.
  6. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    774
    @Dan4x8 Can you please file an official bug for this issue and share the bug number in this thread? https://unity3d.com/unity/qa/bug-reporting

    I'm also not clear-- are you saying that you believe this issue with image removed events firing multiple times after session reset was introduced in 5.0.6?

    To your first question-- you cannot manually re-add a tracked image after ARSession.Reset. Session reset wipes all the trackable data for all subsystems, so the tracked image would need to come back into view and generate a new trackable for you to be able to track its position again.
     
    KyryloKuzyk likes this.