Skip to content

Commit

Permalink
Read Display refresh rate in UnityXR
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeskydev committed Oct 16, 2023
1 parent 7aab9cd commit 09e899d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Assets/Scripts/VrSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Management;

#if PICO_SUPPORTED
using PicoInput = Unity.XR.PXR.PXR_Input;
Expand Down Expand Up @@ -740,7 +741,7 @@ public bool IsHmdInitialized()
switch (App.Config.m_SdkMode)
{
case SdkMode.UnityXR:
return UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager.activeLoader != null;
return XRGeneralSettings.Instance.Manager.activeLoader != null;
default:
return true;
}
Expand All @@ -752,6 +753,11 @@ public int GetHmdTargetFrameRate()
switch (App.Config.m_SdkMode)
{
case SdkMode.UnityXR:
if (XRGeneralSettings.Instance.Manager.activeLoader.GetLoadedSubsystem<XRDisplaySubsystem>().TryGetDisplayRefreshRate(out float rate))
{
Debug.Log($"Subsystem refresh rate: {rate}");
return (int)rate;
}
return 60; // 90?
case SdkMode.Monoscopic:
return 60;
Expand Down

0 comments on commit 09e899d

Please sign in to comment.