-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameRate.cs
More file actions
27 lines (24 loc) · 950 Bytes
/
FrameRate.cs
File metadata and controls
27 lines (24 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using UnityEngine;
using Vuforia;
public class FrameRateSettings : MonoBehaviour
{
void Start()
{
VuforiaApplication.Instance.OnVuforiaStarted += OnVuforiaStarted;
}
void OnVuforiaStarted()
{
// Query Vuforia for recommended frame rate and set it in Unity
var targetFps = VuforiaBehaviour.Instance.CameraDevice.GetRecommendedFPS();
// By default, we use Application.targetFrameRate to set the recommended frame rate.
// If developers use vsync in their quality settings,
// they should also set their QualitySettings.vSyncCount
// according to the value returned above.
// e.g: If targetFPS > 50 --> vSyncCount = 1; else vSyncCount = 2;
if (UnityEngine.Application.targetFrameRate != targetFps)
{
Debug.Log("Setting frame rate to " + targetFps + "fps");
UnityEngine.Application.targetFrameRate = targetFps;
}
}
}