I am trying to hide the standard resolution and input dialog. Actually, yes, just hinding it is easy. But...
I have made an options manager that handles resolution , fullscreen and quality settings and also saves and loads them to / from an XML file. In the Start() function it has:
And this works almost perfectly until I actually hide the resolution dialog. (Almost because the Unity splash screen loads in the default resolution and the resolution only gets reset afterwards. But nevermind that for now.) Once I set the dialog to hidden in the player settings the game always loads in the default resolution set in the player settings. The functions in Start() still get called Log message shows), but the resolution is not reset. It does work to apply the options again from the options GUI I made, but not anymore on startup.
I have looked in the playerPrefs in the registry to see what happens there. When setting the resolution in the options GUI the correct resolution gets saved to the playerPrefs. But on the next start they get reset to the default resolution again. This behavior does not occur when the resolution dialog is show, even if it's with a "hidden by default" dialog and shift-clicking the .exe. The dialog even shows the correct saved resolution then.
I tried executing the functions in Start() on loading the next scene (main menu), and this works, but only if the first scene is not "empty" (just a script to load the options manager and load the next scene).
tl;dr: When hiding the resolution dialog, the settings in playerPrefs always get reset to the defaults from the player settings.
I think this is basically the same as here link here (top related question) which did not get answered for quite some time. I'm at a loss here. This looks like a bug, but usually when I think it is a bug I am just overlooking something. ;)
hey even if this is an old topic, in the man page you have this "A resolution switch does not happen immediately; it will actually happen when the current frame is finished." and it could mean that you'll have to set the resolution in a separated frame than the rest of the loads try it out with a bool for next frame use
I've taken the following approach (for now): Have two scenes at startup, the first contains my options manager which loads and sets the resolution, and in the second scene a script that sets the resolution again. This only works with setting the resolution twice, if I only do it in the first scene it won't work (my guess is that the scripts don't have full control at this point, yet). This creates some screen-flickering at startup, and the unity splashscreen is still shown at the default res. I think I will file a bug report for this (Unity might be interested in having their splash screen shown pretty :) )
answered Nov 30 '10 at 03:51 PM