Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  5. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Unity XR Plugins and Subsystems

Discussion in 'AR/VR (XR) Discussion' started by matthewr_unity, Jun 12, 2019.

  1. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    137
    Can I create the XR plugin with C#?
     
  2. HuiyunChen

    HuiyunChen

    Joined:
    Oct 22, 2020
    Posts:
    1
    Have you figured it out?
     
  3. Gobstar

    Gobstar

    Joined:
    Nov 12, 2015
    Posts:
    6
    Did you ever get a response on FFR?
     
  4. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    745
    @Gobstar FFR is supported in recent Oculus XR Plugin versions. Works in built-in and URP 10 (and maybe earlier, not sure when it was added).
     
  5. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    173
    How do you get Trigger touch and Thumb touch using XR Plugins?? OculusUsages do not work!
     
  6. mikerz1985

    mikerz1985

    Joined:
    Oct 23, 2014
    Posts:
    79
    Use the legacy input system and make sure you setup all the Axes for vr input, or use the new input action system with default mappings, or get the oculus plugin from the store and directly use their methods
     
  7. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    173
    So XR Plugins system still dont support touch detection?( Could you please point me to some info on using legacy input for VR?
     
  8. jaredlandetta

    jaredlandetta

    Joined:
    Jan 5, 2021
    Posts:
    1
    I'm running into the same error. I'm using a MagicLeap1 and one of their templates (Unity Template -0.24.0) from their website. I'm not sure what to do.
     
  9. RuneShiStorm

    RuneShiStorm

    Joined:
    Apr 28, 2017
    Posts:
    207
    What is this XR for? I have it and it give me error messages but I cant remember why I go it.. Does it have anything to do with Porting to Xbox?
     
  10. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    63
    XR = eXtended Reality. VR = Virtual Reality. AR = Augmented Reality.

    Please use Google next time before spamming the forums. Or just read a couple of the forum entries.
     
  11. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    172
    By setting an enum in the project Hierarchy it helps me with the workflow without having to go to player settings everytime enabling / disabling the XR Manager

    With the code below i am trying to achieve 2 things:

    When the enum is set to CLIENT_DESKTOP -- i do not want SteamVR(or any other device) to be launched at application start, in either the editor or the build...
    This works for either.case

    When the enum is set to CLIENT_VIRTUAL_REALITY -- i do want VR to be initialized
    This only works with the editor... with a build i am getting a black screen

    Does anyone know what i am missing, or know of a better workflow?

    Thanks

    This script has been set as first script in the execution order

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.XR;
    6. using UnityEngine.XR.Management;
    7. using Valve.VR;
    8.  
    9. namespace Project
    10. {
    11.     public class ProjectSettings : MonoBehaviour
    12.     {
    13.         public GameObject cameraDesktop;
    14.         public GameObject cameraVirtualReality; //SteamVR CameraRig
    15.  
    16.         [SerializeField] Unity.XR.Oculus.OculusLoader oculusLoader; // Scriptable Object
    17.         [SerializeField] Unity.XR.OpenVR.OpenVRLoader openVRLoader; // Scriptable Object
    18.  
    19.         public static ProjectSettings instance;
    20.  
    21.         public enum ClientType
    22.         {
    23.             CLIENT_DESKTOP,
    24.             CLIENT_VIRTUAL_REALITY
    25.         }
    26.  
    27.         public ClientType clientType;
    28.  
    29.         private void Awake()
    30.         {
    31.             if (instance == null)
    32.             {
    33.                 instance = this;
    34.  
    35.                 if (clientType == ClientType.CLIENT_VIRTUAL_REALITY)
    36.                 {
    37.                     List<XRLoader> xrLoaderList = UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.loaders;
    38.                     xrLoaderList.Clear();
    39.  
    40.                     UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.loaders.Add(openVRLoader);
    41.                     UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.loaders.Add(oculusLoader);
    42.  
    43.                     UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.automaticLoading = true;
    44.                     UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.automaticRunning = true;
    45.  
    46.                     StartCoroutine(EnableVirtualReality());
    47.                 }
    48.                 else
    49.                 {
    50.                     List<XRLoader> xrLoaderList = UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.loaders;
    51.                     xrLoaderList.Clear();
    52.  
    53.                     cameraDesktop.SetActive(true);
    54.                 }
    55.  
    56.                 LoadResources();
    57.             }
    58.         }
    59.  
    60.          private IEnumerator EnableVirtualReality()
    61.         {
    62.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
    63.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.activeLoader.Initialize();
    64.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.activeLoader.Start();
    65.             yield return null;
    66.  
    67.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.StartSubsystems();
    68.             yield return null;
    69.  
    70.             cameraVirtualReality.SetActive(true);
    71.             yield return null;
    72.         }
    73.  
    74.         private void OnApplicationQuit()
    75.         {
    76.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.automaticLoading = false;
    77.             UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.automaticRunning = false;
    78.  
    79.             if (clientType == ClientType.CLIENT_VIRTUAL_REALITY)
    80.             {
    81.                 UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.DeinitializeLoader();
    82.  
    83.                 List<XRLoader> xrLoaderList = UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.loaders;
    84.                 xrLoaderList.Clear();
    85.             }
    86.             else
    87.             {
    88.             }
    89.         }
    90.     }
    91. }
    92.  
     
  12. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    172
  13. ozgurozansen

    ozgurozansen

    Joined:
    Oct 24, 2013
    Posts:
    2
    I just can't stand that Unity oficially pretends that such an option (Stereo Display [non-head mounted]) never presented. Unity is the #1 API to breaks working things in future versions and never talk about them.

    We also use a CAVE-like system and ugraded our own framework to work with UIToolkit component, which means we now depend on the 2020+ versions. But, surprise! Unity removed the Stereo Display option in their new XR Management subsystem and kills the legacy XR. Moreover, there is no tutorial or satisfying documentation to start developing (from scratch here obviously) your own plug-in for non-HMD systems.

    Have you been successful in your case using Unity 2020+ along with your CAVE system?
     
    daftechnologylab likes this.
unityunity