Search Unity

Adding XR Rig from a prefab at runtime doesn't work

Discussion in 'AR/VR (XR) Discussion' started by blackfox_studio, Jun 10, 2020.

  1. blackfox_studio

    blackfox_studio

    Joined:
    Apr 8, 2019
    Posts:
    40
    If I try to instantiate the whole VRPlayerController (> Camera Offest > VR Camera > Left/Right Hand) starting from a prefab and deploy on my OculusQuest I just get a still frame. If I place the VRPlayerController directly in the scene before deploying it then it works well.
    What could be the problem
     
  2. game_burger

    game_burger

    Joined:
    Mar 31, 2022
    Posts:
    2
    Having the same issue, hope someone responds
     
  3. j-vergeldt

    j-vergeldt

    Joined:
    Sep 5, 2015
    Posts:
    1
    If you want to spawn prefabs on runtime you need them to be in a folder called Resources.
     
  4. DarkSoulsBoss2

    DarkSoulsBoss2

    Unity Technologies

    Joined:
    Mar 24, 2023
    Posts:
    23
    The reason this doesn't work is because the camera in VR needs to be initialized at project startup time. It may be possible to switch from one camera to a newly instantiated one, but you need the VR camera to be enabled at startup