RefreshRate
Represents the display refresh rate, or the number of frames the display can show per second.
Read time 2 minutesLast updated 3 days ago
Definition
- Type: Struct
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<RefreshRate>, IComparable<RefreshRate>
public struct RefreshRate : IEquatable<RefreshRate>, IComparable<RefreshRate>
Remarks
A display refresh rate is always a rational number expressed as a fraction with a numerator and a denominator. For example, a 59.94 Hz display might have a numerator of 60000 and a denominator of 1001.
Pass a to Screen.SetResolution to request a specific refresh rate. To find the rates a display supports, read Resolution.refreshRateRatio from each entry in Screen.resolutions.
RefreshRateNote: Screen.SetResolution applies the requested refresh rate only in FullScreenMode.ExclusiveFullScreen. Only the Windows standalone Player supports this mode, and only when it uses the D3D11 or D3D12 graphics API. In all other cases, the request falls back to FullScreenMode.FullScreenWindow, which keeps the display's current refresh rate.
Examples
using UnityEngine;public class Example : MonoBehaviour{ // Prints the refresh rate of every mode the monitor supports. void Start() { foreach (Resolution resolution in Screen.resolutions) { RefreshRate rate = resolution.refreshRateRatio; // A 59.94 Hz mode reports as 60000/1001. Debug.Log(resolution.width + "x" + resolution.height + " at " + rate.numerator + "/" + rate.denominator + " (" + rate.value + " Hz)"); } }}
Fields
Value | Description |
|---|---|
| denominator | Denominator of the refresh rate fraction. |
| numerator | Numerator of the refresh rate fraction. |
Properties
Property | Description |
|---|---|
| value | The numerical value of the refresh rate in hertz. |
Methods
Method | Description |
|---|---|
| Equals | Returns true if the refresh rates are equal. |
| GetHashCode | Returns the hash code for this refresh rate. |
Operators
Operator | Description |
|---|---|
| operator == | Returns true if two refresh rates are equal. |
| operator != | Returns true if two refresh rates are unequal. |