PlayerPrefs for Screen Resolution ignored in Windows builds

In our project we've disabled the display of the resoultion dialog. Even if we change the screens settings via PlayerPrefs.SetInt("Screenmanager Resolution Width", 640) and PlayerPrefs.SetInt("Screenmanager Resolution Height", 480) or manually via the registry editor the new values are ignored at startup and the inital values of 'Player Settings' 'Default Screen Width' and 'Default Screen Height' are used instead.
Is there any workaround for that behaviour instead of setting those values via script SetResoluation() (which causes screen flickering) at startup of the application?

I'm having this exact same problem. Did you ever get it resolved?

We use a config file for our application and when the app starts, we set the screen resolution manually with Screen.SetResolution().

Blimey. I was hoping you wouldn't say that. Switching res twice is a problem for my project. I've noticed that apps that use the regular resolution selection dialog don't have this problem, which makes me think that these settings are JUST getting set in the registry, but are being stored somewhere else as well. This is corroborated by tests I've done on the Mac that show that it is getting persistent settings information from somewhere even after I've deleted the preference file.

I'm noticing this issue also. When the dialog window is disabled it seems to always pull from the default as set up in the editor, and writes out a new set of preferences to the registry even if it never reads them. It would be nice if we can change the registry externally and then have unity actually read the file (without the dialog) and use those settings. But alas I think it's not designed for that?

No matter what I've tried I can't get it to use the settings I put into the external file, unless perhaps the dialog is displayed, but that defeats the purpose.

You have to do that in your start screen when resoluation shouldn't matter that much.
You can find the setting in the registry under HK_CURRENTUSER\YourCompany\ApplicationName.

Yah I know it's in the registry but no matter what is set in the registry it has no effect on how the application shows. I tried changing it externally and Unity just insists on overwriting whatever changes I made with its defaults.

Jep - that's why we change the screen resolution manually in the start screen - it's just a bug that never got fixed!

1 Like

Yah that's what I'm going to have to do, start up in a high resolution (probably the desktop resolution in most cases, and the one in which the unity logo looks normal), and then adjust the resolution in script if needed. Not ideal, because it means that in order to, for example, start up in windowed mode sometimes but not always, I have to have 2 separate versions of the app.

This is still happening. Is there any chance of this getting fixed soon?

Yes... is it going to get fixed, I just encountered this also ...

It looks like this is still a problem... I ran into it myself and found a bug suggestion on the Unity feedback site to vote for.

oh my god, this is so pathetic! This lousy bug exists for 3 (!!!) years and still not fixed! Guys, are you kidding us!?

I get the impression that fixing anything involving the Stand alone player generally is a lower priority to Mobile and Web platforms.

I have written my own in game Screen Mode UI which is pointless because of this issue.

Another example: the InputManager is less than ideal for games that want to configure their own controls in game and there is still a bug in the GetRawInput function that returns bad data and can only be fixed by changing the Players registry setting to use DirectInput. A fix that is undocumented...

[quote=“vladk”, post:13, topic: 382601]
oh my god, this is so pathetic! This lousy bug exists for 3 (!!!) years and still not fixed! Guys, are you kidding us!?
[/quote]
Now, 5 years later…

[quote=“Lohoris2_1”, post:15, topic: 382601]
Now, 5 years later…
[/quote]
Now 8 Years and not solved

Bug report with repro project please, otherwise it won't be fixed.

This works fine for me. I haven't tested a lot but have you checked if the resolution you are trying conforms with your supported aspect ratios in the Resolution and Presentation section of the PC player settings.

Yes i did that Exactly i get all the supported resolutions and the setting it afterwards by users choice

This still doesn't work properly. You cannot configure these settings and enforce a specific display resolution through the player build settings.