- Home /
Current Desktop Resolution
Is there a way I can set Unity app resolution to the current desktop´s resolution during runtime (at startup) without using that input/resolution window?
Answer by DaveA · Nov 08, 2011 at 11:55 PM
http://unity3d.com/support/documentation/ScriptReference/Screen-resolutions.html
http://unity3d.com/support/documentation/ScriptReference/Screen.SetResolution.html
Thanks, DaveA.
I am aware of Screen.resolutions and SetResolution. However I still can´t get the current desktop resolution with them.
The way I wanted, there would be no resolution dialogs. The game would startup using the PC current resolution. "Screen.resolutions" tells me the supported resolutions but not the one that is being used. I could just read it out and then set to the maximum resolution but that´s risky. In example, my monitor tells me it support 1600x1200 but it crashes when I set it... I guess I´ll have to stick with the resolution selection until I find something.
http://unity3d.com/support/documentation/ScriptReference/Screen-currentResolution.html says it returns current resolution of the desktop
Well, then I´ll start it in windowed mode, catch the resolution and then set it to fullscreen in the correct resolution. Thanks!
I could be wrong, but I think you need to be careful with Screen.currentResolution as well.
I believe it will return the maximum supported resolution for the current monitor. This means that you could experience issues if the user is not using the "recommended" resolution.
For example: if my monitor supports 1920x1200, but I have it set to something smaller, I believe Screen.currentResolution will still retrurn 1920x1200.
jahroy, that´s a valid point. To be sure, I´ve just tested it and it returns the resolution in use, not the maximum supported.
Your answer
Follow this Question
Related Questions
Actual Desktop Resolution 1 Answer
resize standalone game window with mouse 2 Answers
How to set arbitrary window size when not in fullscreen? 0 Answers
Game window too small? 0 Answers