jpalmer999
jpalmer999

Reputation: 19

How to detect available resolutions on users monitor?

I am trying to essentially make a launcher for my Unity game that allows the user to adjust graphical and audio options. However, I can't seem to find a way to display all the possible resolutions the user's monitor supports. Is this possible at all?

Jonathan Palmer

Upvotes: 2

Views: 868

Answers (2)

Tiberiu Maran
Tiberiu Maran

Reputation: 2173

The Unity solution is Screen.resolutions.

If you're looking for a solution before starting the Unity app, you have to use something native. On Windows you can try the solution mentioned here.

Upvotes: 1

derHugo
derHugo

Reputation: 90620

You are probably looking for Screen.resolutions

All full-screen resolutions supported by the monitor (Read Only).

public class ExampleScript : MonoBehaviour
{
    void Start()
    {
        Resolution[] resolutions = Screen.resolutions;

        // Print the resolutions
        foreach (var res in resolutions)
        {
            Debug.Log(res.width + "x" + res.height + " : " + res.refreshRate);
        }
    }
}

Upvotes: 4

Related Questions