- Home /
How to use Resolution.refreshRate?
Hi, so I am making a game for web players and I want to display the refresh rate of the monitor in the options menu, and I've already made it so that I can see the width and the height, but I just don't know how to use Resolution.refreshRate because it always returns an error saying something that it's trying to access a non-static member or whatever.
Here's my script:
var Text : TextMesh;
var x;
var y;
var rate;
function Update () {
x = Screen.width;
y = Screen.height;
rate = Resolution.refreshRate;
Text.text = "Resolution: " + x + "x" + y + " @ " + rate;
}
Never use code like "var x"...always define the type like "var x : int".
@prototype7: no, that's not what it means at all.
Answer by Eric5h5 · Jun 29, 2014 at 03:50 PM
You can't use Resolution like that. You should use Screen.resolutions, which returns a Resolution array.
Your answer
![](https://koobas.hobune.stream/wayback/20220613152805im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI Scale Problem 1 Answer
Possible to change screen res from script? 2 Answers
Moving gameobject relative to resolution 1 Answer
Detect resolution selected in Editor Game view? 2 Answers
GUI Resolution Ajust 1 Answer