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
What is the correct way of loading AR and non AR scenes in sequence? #726
Comments
It depends on whether you want the current AR session to remain active between AR scenes. If you do, you do not need to deinitialize/initialize between scene loads. If you want to recreate it, you can either deinit/init or simply call ARSession.Reset().
It's just the way the samples are structured. We want to make sure AR is shutdown whenever we go back to the main menu.
This should be fine; I believe the input subsystem error message can be safely ignored. |
|
The sample you are trying to modify was not written with the use case you are trying to achieve, i.e., changing between different AR scenes.
Depends on your use case, but you do not need to deinit/init in order to use different subsystems in a different scene. |
|
OK thanks, this makes sense but it doens't explain why the image tracking stops working if I don't deinit/init going from an image tracking scene to another. Is image tracking the problem? Or is it the multiple prefabs script? I tried to modify the multiple prefabs script to simplify it and adding the tracked images names manually, but the problem seems to be the same: |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |

I can see in the repo samples, going from non AR scene (menu) to AR scene is done with:
LoaderUtility.Initialize();SceneManager.LoadScene(sceneName, LoadSceneMode.Single);while going from an AR scene to a non AR scene is done with:
SceneManager.LoadScene("Menu", LoadSceneMode.Single);LoaderUtility.Deinitialize();Why is Deinitialize called right after the scene load command and not at the beginning of the newly loaded scene?
Also, what is the correct way of going from an AR scene to another AR scene? I tried this:
var xrManagerSettings = XRGeneralSettings.Instance.Manager;xrManagerSettings.DeinitializeLoader();SceneManager.LoadScene("My other AR scene", LoadSceneMode.Single); //Load another AR scenexrManagerSettings.InitializeLoaderSync();which seems to work but I get the following error in Logcat (Android):

If I call only:
SceneManager.LoadScene("My other AR scene", LoadSceneMode.Single); //Load another AR scenexrManagerSettings.InitializeLoaderSync();I get the following warning

If I call only:
SceneManager.LoadScene("My other AR scene", LoadSceneMode.Single); //Load another AR sceneor
SceneManager.LoadScene("My other AR scene", LoadSceneMode.Single); //Load another AR scenexrManagerSettings.InitializeLoaderSync();without any Deinitialize() I also get the following error when I load a scene which perform Image Tracking and th etracking doesn't work:

I experience the exact same errors on iOS, same unity project, on an iPhone XS.
All my scenes are AR scenes but I disable the ARCameraBackground when the scene loads. When I need to perform image tracking I enable the ARCameraBackground using a UI button.
What am I doing wrong? What is the correct order to call
LoaderUtility.Initialize() / Deinitialize()and the scene load command to go from an AR sene to another AR scene?The text was updated successfully, but these errors were encountered: