From 562c0cdb7b347fe6921ac55557b8b9266aad3fee Mon Sep 17 00:00:00 2001 From: Chris <19819051+Chrisdbhr@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:13:10 -0300 Subject: [PATCH 1/2] fix: new Unity APIs --- Runtime/Controllers/RateManagerUpdateRateController.cs | 4 ++++ Runtime/RateManager.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Runtime/Controllers/RateManagerUpdateRateController.cs b/Runtime/Controllers/RateManagerUpdateRateController.cs index 3d4363b..2e8bad8 100644 --- a/Runtime/Controllers/RateManagerUpdateRateController.cs +++ b/Runtime/Controllers/RateManagerUpdateRateController.cs @@ -124,7 +124,11 @@ protected override void ApplyTargetValueToUnitySettings() { // QualitySettings.vSyncCount value must be 0, 1, 2, 3, or 4. // QualitySettings.vSyncCount is ignored on iOS. vSyncCount = Mathf.Clamp( +#if UNITY_2022_2_OR_NEWER + Mathf.RoundToInt((float)UnityScreen.currentResolution.refreshRateRatio.value) / targetFrameRate, +#else UnityScreen.currentResolution.refreshRate / targetFrameRate, +#endif 1, 4 ); diff --git a/Runtime/RateManager.cs b/Runtime/RateManager.cs index bcd2268..19329e6 100644 --- a/Runtime/RateManager.cs +++ b/Runtime/RateManager.cs @@ -38,7 +38,11 @@ public static RateManager Instance { } #endif if (!IsApplicationQuitting && _instance == null) { +#if UNITY_2023_1_OR_NEWER + _instance = FindAnyObjectByType(); +#else _instance = FindObjectOfType(); +#endif if (_instance == null) { var go = new GameObject(); _instance = go.AddComponent(); From 26ccd009049514a30bacbb7fd058653bf1505c09 Mon Sep 17 00:00:00 2001 From: Chris <19819051+Chrisdbhr@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:20:33 -0300 Subject: [PATCH 2/2] editor: updated tools for newer api support --- Editor/RateRequestTrackerTreeView.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Editor/RateRequestTrackerTreeView.cs b/Editor/RateRequestTrackerTreeView.cs index 3247a4a..f7569e2 100644 --- a/Editor/RateRequestTrackerTreeView.cs +++ b/Editor/RateRequestTrackerTreeView.cs @@ -5,6 +5,16 @@ using UnityEditor.IMGUI.Controls; using UniRate.Debug; +#if UNITY_2023_1_OR_NEWER +using TreeView = UnityEditor.IMGUI.Controls.TreeView; +using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; +using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; +#else +using TreeView = UnityEditor.IMGUI.Controls.TreeView; +using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; +using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; +#endif + namespace UniRate.Editor { public class RateRequestTrackerTreeView : TreeView {