This is a question I’ve been having for a long time now and, so far, nobody has been able to answer it.
I want my game to run at a specific resolution and I want to change the user’s desktop/monitor resolution accordingly.
For a clear example, let’s suppose I want my game to run at 800x600, regardless of the fact the user’s monitor is most likely 16:9, just for “teh lolz”.
Unity by default will adjust the render to the user’s current resolution (1920x1080, for example) and kind of scale everything.
Well, I want to change the user’s desktop resolution to 800x600 at the game startup to match my game.
This is the kind of behavior AAA games have. You can easily test it: set your desktop resolution to 1024x768 (for example) and try running some AAA (like Tomb Raider) and you will see that the game will switch the desktop resolution to whatever you choose in-game, like 1920x1080, and when you close the game, it will restore your previous resolution (1024x768 in this case)
I’ve read suggestions about using some methods inside “user32.dll” as demonstrated here: Dynamic Screen Resolution - CodeProject
The problem with this is that:
A) It’s a Microsoft dll so redistributing it with a game might involve some… “legal matters”
B) It only works in Windows. If I want to achieve the same on some other platform, like Linux or OSX, it won’t work.
That’s why I’m asking here if there a way to achieve this with Unity: to easily allow the desktop resolution changing feature to work fine regardles of platform and also to be included with the game with having to worry about the legal matters surrounding it.
Thanks.