Restarting scene get black screen on AR-Foundation Android
I am working on a semi-old solution with unity 2020.3 that is using arfoundation.
On the first start of the AR scene everything works fine, BUT if I try to reopen the AR scene I get the black screen and get this error:
no active unityengine.xr.arsubsystems.xrsessionsubsystem is available
I already tried:
-reload scene
-reload a second scene and then reload the first one.
-destroy the objects before reload scene:
yield return new WaitForSeconds(1f);
var cameraManager = FindObjectOfType<ARCameraManager>();
if (cameraManager != null)
Destroy(cameraManager.gameObject);
yield return new WaitForSeconds(1f);
ARSession arSession = FindObjectOfType<ARSession>();
if (arSession != null)
Destroy(arSession.gameObject);
-restart ar subsistem
XRGeneralSettings.Instance.Manager.StopSubsystems();
XRGeneralSettings.Instance.Manager.DeinitializeLoader();
yield return null; // Attendi un frame
XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
XRGeneralSettings.Instance.Manager.StartSubsystems();
-deinizialize loader
var xrManagerSettings = XRGeneralSettings.Instance.Manager;
xrManagerSettings.DeinitializeLoader();
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); // reload current scene
xrManagerSettings.InitializeLoaderSync();
NOTHING seems to work and I do not know what else to do
any advice or solution?? Please help!!