Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Target framerate of connected headset

Discussion in 'AR/VR (XR) Discussion' started by Charlicopter, Jun 17, 2020.

  1. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125
    I'm in need of Application.targetFrameRate property, but for XR.
    When running in XR, Application.targetFrameRate will default to -1 because the application frame rate is slaved to the particular XR API in use.
    It would be very helpful to my application if I could access the framerate that the HMD is trying to hold. Is this possible?
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  3. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125
    I think this is exactly what I'm looking for.
    How is this class implemented? When I new up an instance of XRDisplaySubsystem and try to start it, Unity throws:

    ArgumentNullException: Value cannot be null.
    Parameter name: _unity_self

    I'm probably overlooking something pretty simple here...
    Very helpful, thank you.
     
  4. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125
    Here's where I'm at:
    Install Subsystem Registration package, then:

    (Edit)

    Code (CSharp):
    1.         List<ISubsystemDescriptor> subsystemDiscriptors = new List<ISubsystemDescriptor>();
    2.         SubsystemManager.GetAllSubsystemDescriptors(subsystemDiscriptors);
    3.  
    4.         foreach(ISubsystemDescriptor descriptor in subsystemDiscriptors)
    5.         {
    6.             Debug.Log(descriptor.id);
    7.         }
    But I'm unable to retrieve any of the descriptors to create. The list is always empty...

    (Edit #2) Aha...I understand now: The XR Plug-in manager delegates the subsystems to the subsystem manager. Now we wait for Valve to release OpenVR Plugin for Unity...
     
    Last edited: Jun 17, 2020
  5. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  7. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    125