Log in or register to post comments

The type name 'CameraDirection' does not exist'

March 24, 2019 - 5:08am #1

Hi there!

After I update my Vuforia from 8.0 to 8.1.7 I got this error:

NatCamCapturePhoto.cs(22,26): error CS0426: The type name 'CameraDirection' does not exist in the type 'CameraDevice'

 

this is the code:

    private Texture2D _CapturedPhoto;

    private CameraDevice.CameraDirection _CameraDevice;

    private DeviceCamera _DeviceCamera;

//--------------------------------------------------

    private void Start()

    {

        CameraDevice.Instance.GetSelectedCameraDirection(out _CameraDevice);

        print(_CameraDevice);

        if (_CameraDevice == CameraDevice.CameraDirection.CAMERA_BACK)

            _DeviceCamera = DeviceCamera.RearCamera;

        else if (_CameraDevice == CameraDevice.CameraDirection.CAMERA_FRONT)

            _DeviceCamera = DeviceCamera.FrontCamera;

        else

        {

#if UNITY_ANDROID && !UNITY_EDITOR

            _DeviceCamera = DeviceCamera.RearCamera;

#elif UNITY_EDITOR

            _DeviceCamera = DeviceCamera.FrontCamera;

#endif

        }

        CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);

        NatCam.StartPreview(_DeviceCamera, OnStart);

    }

 

Also I have code to turn camera:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using ARCamera = Vuforia.CameraDevice;

public class SwitchARCamera : MonoBehaviour

{

public void SwitchCamera()

{

  ARCamera.Instance.Stop();

  ARCamera.Instance.Deinit();

  ARCamera.CameraDirection dir = ARCamera.Instance.GetCameraDirection();

  if (dir == ARCamera.CameraDirection.CAMERA_FRONT)

   ARCamera.Instance.Init(ARCamera.CameraDirection.CAMERA_BACK);

  else ARCamera.Instance.Init(ARCamera.CameraDirection.CAMERA_FRONT);

  ARCamera.Instance.Start();

}

}

Can you please help me to fix it?

Best Regards,

Fabio

The type name 'CameraDirection' does not exist'

March 26, 2019 - 9:23am #2

Hello,

Front camera support was removed in Vuforia 8.1. This means that the camera direction is no longer relevant so the APIs were updated.

https://library.vuforia.com/content/vuforia-library/en/articles/Release_Notes/Vuforia-SDK-Release-Notes.html

Thanks,

Vuforia Engine Support

Log in or register to post comments