Log in or register to post comments

Camera Flipping Doesn't Work (Unity)

December 1, 2017 - 8:12pm #1

Hey everyone, I'm having trouble with my camera switching script for Android. This script works correctly on iOS, but on Android it's not flipping the camera from front to rear when clicked. Here's where it gets weird. If I click to another Unity scene within the app and return to the previous scene the camera will initialize to the camera most recently selected. I.e. I'm using front camera, click the button, nothing happens. I click to my "help" scene and then return to my "viewer" scene and the camera is now rear camera. Any thoughts?

This is the code snippet that I've been using and has been working correctly on iOS... I'm running Android 7.


public void OnSwitchCamera()


        if (VuforiaConfiguration.Instance.Vuforia.CameraDirection == CameraDevice.CameraDirection.CAMERA_FRONT)

            VuforiaConfiguration.Instance.Vuforia.CameraDirection = CameraDevice.CameraDirection.CAMERA_BACK;


            VuforiaConfiguration.Instance.Vuforia.CameraDirection = CameraDevice.CameraDirection.CAMERA_FRONT;





Camera Flipping Doesn't Work (Unity)

December 4, 2017 - 2:38pm #2

Hello cleverfoxvr,

The Core Samples provide some example code for switching between the front and back cameras. The MenuOptions.cs and CameraSettings.cs files contain code that will properly switch between the two cameras.

Based on your code, your issue is likely due to not stopping the ObjectTracker and CameraDevice before switching camera direction. Please refer to the 'RestartCamera' function in the CameraSettings.cs file.


Vuforia Support

Log in or register to post comments