Log in or register to post comments

Camera Change AR to VR

June 20, 2018 - 12:09am #1

Nice to meet you.

I am trying to make MR application using Vuforia and GoogleVR.

I faced a problem in the process, so I am seeking someone's help.

The problem arises when the application does ARcamera.SetActive (false)  and MainCamera.SetActive (true). (ARcamera and MainCamera is GameObject)

The following error occurs in Xcode.

2018-06-20 15: 07: 24.540018 + 0900 ProductName [13806: 5184991] ERROR / AR (13806) 2018-06-21 15: 07: 24: CameraDevice :: getCameraCalibration (): Failed to get camera calibration because the camera is not initialized.

ERROR / AR (13806) 2018 - 06 - 21 15: 07: 24: CameraDevice :: getCameraCalibration (): Failed to get camera calibration because the camera is not initialized.

ERROR / AR (13806) 2018 - 06 - 21 15: 07: 24: You must successfully set a mode with Device.setMode before retrieving RenderingPrimitives

 

Switching between AR mode and VR mode is done with the following code.

if(EyeControllerAR.ARon){

   VRmode.SetActive(false);

   StartCoroutine("LoadAR");

   ARmode.SetActive(true);

  }else{

   ARmode.SetActive(false);

   StartCoroutine("LoadVR");

   VRmode.SetActive(true);

  }

IEnumerator LoadAR()

    {

        XRSettings.LoadDeviceByName("Vuforia");

        Debug.Log("Load Vuforia");

        yield return null;

    }

IEnumerator LoadVR()

    {

        XRSettings.LoadDeviceByName("Cardboard");

        Debug.Log("Load Cardboard");

        yield return null;

    }

Device changes are done with XRsettings.LoadDeviceByName and the Virtual Reality SDKs includes Cardboard and Vuforia.

How can I switch between AR camera and VR camera without this error?

Thank you for reading to the end.

I look forward to your reply.

mascut

Camera Change AR to VR

December 20, 2018 - 4:39am #3

I have an simular issue with iOS.

Cannot setMode to AR before Camera is initialized

August 29, 2018 - 5:12am #2

when i export my unity code to Android Studio its getting error Cannot setMode to AR before Camera is initialized 

Log in or register to post comments