3
\$\begingroup\$

in my unity project I have multiple screens. How can I set resolution of each screen? I know Screen.SetResolution(1366,768,true); sets the resolution of a single screen but what about multiple screens?

I disabled unity pop up option before starting the game. Does unity choose maximum resolution by default?

\$\endgroup\$
  • \$\begingroup\$ Did you have "Unity Script" in the title because you're using unityscript? \$\endgroup\$ – doppelgreener Jun 12 '17 at 11:15
6
\$\begingroup\$

You need to use the Display class to activate and change resolution of additional displays.

You can access the additional displays using Display.display[i], where i is the display index (main = 0, 2nd = 1, etc.).

Use Display.display[i].Activate(display_width, display_height, display_refreshRate) to activate the additional displays.

Edit: to answer your question in the comment, to make a secondary display go fullscreen, you just need to set its resolution to the native one:

Display.displays[1].Activate();
Display.displays[1].SetRenderingResolution(Display.displays[1].systemWidth,
                                           Display.displays[1].systemHeight);

or, directly,

Display.displays[1].Activate(Display.displays[1].systemWidth,
                             Display.displays[1].systemHeight, 60);

if the refresh rate is 60 (with the second method, you can't read inside Unity the refresh rate of the secondary display, so you need to know it before hand, or just use SetRenderingResolution to let the graphic card drivers choose it without bothering).

Another important info that I forgot to mention: when inside the Editor, the number of displays reported by the Display class will always be one, the correct number will be reported only in a standalone build (and it only works for PC/Mac/Linux builds).

\$\endgroup\$
  • \$\begingroup\$ what about making all of them full screen? \$\endgroup\$ – virtouso Jun 13 '17 at 2:21
  • \$\begingroup\$ I'll edit my answer to add this info and another one that I forgot to mention before. \$\endgroup\$ – Galandil Jun 13 '17 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.