Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to destroy or restart ARTrackedImageManager? #1107

Open
dorkbot opened this issue Sep 27, 2023 · 11 comments
Open

Need to destroy or restart ARTrackedImageManager? #1107

dorkbot opened this issue Sep 27, 2023 · 11 comments
Labels
how to Explains how to accomplish something needsinvestigation Requires further investigation by Unity

Comments

@dorkbot
Copy link

dorkbot commented Sep 27, 2023

I have a scene with image tracking, it works. But when the app leaves this scene and loads another, then loads the image tracking scene again, the trackedImagesChanged action never returns objects in ARTrackedImagesChangedEventArgs.added again, it only has objects in ARTrackedImagesChangedEventArgs.updated, even after the scene reloads...

I've tried
ARTrackedImageManager.subsystem.Destroy(); but that didn't change the issue.
Also tried ARSession.Reset(), but still no luck.

How do I completely restart ARTrackedImageManager so when the scene loads it's fresh?

Thank you!

@andyb-unity
Copy link
Collaborator

@dorkbot
Copy link
Author

dorkbot commented Sep 27, 2023

Thank you, but I attached that script to a GameObject in the scene and no luck. Once an image is added it is never added again after a scene is loaded. I have to quit the app to get a tracked image to get added again. Does that make sense? The data must be stored somewhere else? Some static ref somewhere...

@andyb-unity
Copy link
Collaborator

Hm. That seems like a bug to me if so. ARTrackedImageManager predates my time at Unity so I'm not sure what the issue is here. Flagging this as needs investigation to see if we can assign someone to look at this in a future sprint.

@andyb-unity andyb-unity added the needsinvestigation Requires further investigation by Unity label Sep 27, 2023
@andyb-unity
Copy link
Collaborator

@dorkbot What platform(s) / devices are you seeing this?

@dorkbot
Copy link
Author

dorkbot commented Sep 28, 2023

Hi, I'm using Unity 2022.3.7f1. And testing Android builds on a Pixel 6.

@dorkbot
Copy link
Author

dorkbot commented Sep 28, 2023

I suspect there is a similar issue when using ARPlaneManager. It appears that planes are stored so when the scene reloads it's using planes from the previous session. I'm not saying the issue is specifically with ARPlaneManager and ARTrackedImageManager, maybe it's a subsystem or something. My app has a two scenes that use one of each manager.

@dorkbot
Copy link
Author

dorkbot commented Oct 26, 2023

@andyb-unity Is there any update? I am having issues with Plane AR. In my app when I leave the AR Plane scene then return there are planes left from the previous session, the scene gets sorta polluted. Is there suppose to be a solution for clearing all planes?

@andyb-unity
Copy link
Collaborator

andyb-unity commented Oct 27, 2023

Do you have the same issue in our sample app? https://github.com/Unity-Technologies/arfoundation-samples

Personally I've never seen the issue you describe.

@dorkbot
Copy link
Author

dorkbot commented Oct 27, 2023

I guess I can try to create a test, but my scene is built exactly the same way and there's nothing I've done that would explain why detected planes from a previous scene load/session would be present. Or why ARTrackedImagesChangedEventArgs.update would have tracked info when a scene loads but not ARTrackedImagesChangedEventArgs.added. For both plane detection and image tracking, the scenes are loading with the previous session's data.

You guys are not able to recreate it?

:(

@dorkbot
Copy link
Author

dorkbot commented Oct 27, 2023

It's 100% of the time for me

@MinasKatsiokalis
Copy link

MinasKatsiokalis commented Mar 11, 2024

I solved whtis issue by createing a new ARTrackedImageManager component each time I load fresh my AR scene.
Then, I set the referenceImage library with all the images I want to track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
how to Explains how to accomplish something needsinvestigation Requires further investigation by Unity
Projects
None yet
Development

No branches or pull requests

3 participants