Search Unity

Combine VR and AR in the same app

Discussion in 'AR/VR (XR) Discussion' started by pointmedia, Nov 13, 2018.

  1. pointmedia

    pointmedia

    Joined:
    Feb 18, 2015
    Posts:
    1
    Is it possible to make an app that contains both an AR (Vuforia) experience and a VR experience?
    They would, in this case, be separated, so the user can choose to do VR or AR from a menu.

    As for now, my challenge is that I in unity must choose VR or AR under player settings.
     
  2. jayasurya00098

    jayasurya00098

    Joined:
    Apr 17, 2017
    Posts:
    1
    Yes, It is Possible to have both AR and VR in the Same Application.

    In XR Settings Enable Both Virtual Reality Supported and Vuforia Augmented Reality Supported. Under Virtual Reality Support add two SDK's 1. None & 2. The SDK you want to use (for example say "Cardboard").

    Using Both AR Camera & Main Camera in your scene. If your in AR mode enable AR Camera and disable Main Camera, when you want to switch to VR Mode :
    1. Disable AR Camera, Pause Vuforia and Enable Main Camera.
    2. by using XRSettings.LoadDeviceByName ("Cardborad"); you can enable VR mode.
    ref: https://docs.unity3d.com/ScriptReference/XR.XRSettings.LoadDeviceByName.html

    When you want to comeback to AR mode again,
    1. use XRSettings.LoadDeviceByName ("None"); and disable Main Camera.
    2. Enable AR Camera and Resume Vuforia.
     
    hongyupan likes this.