x


Bug when hiding resolution Dialog? (Settings get reset on startup)

Hi.

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:

 function Start () {

    Application.targetFrameRate = 70;

    ResetOptions(); // Load defaults
    LoadOptions();  // Load XML file
    ApplyOptions(); // Apply the settings
    Debug.Log("Loaded Options");
}

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. ;)

more ▼

asked Nov 01 '10 at 10:27 PM

Markus Haeublein gravatar image

Markus Haeublein
33 2 2 7

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

This may or may not be helpful, but here are two threads that appear to be on the same topic:

Thread 1

Thread 2

I'm trying to solve the same problem (or at least a similar one), but I haven't had any luck so far.

more ▼

answered Nov 02 '10 at 12:24 AM

Jesse Anders gravatar image

Jesse Anders
7.3k 7 17 48

Took me some time to get back to this as there where more important things in the way. Your answer was at least helpful in showing me it's not me being stupid. :)

Nov 30 '10 at 03:47 PM Markus Haeublein
(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Oct 10 '12 at 05:31 PM

moka_one gravatar image

moka_one
21 1 1 2

(comments are locked)
10|3000 characters needed characters left

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 :) )

more ▼

answered Nov 30 '10 at 03:51 PM

Markus Haeublein gravatar image

Markus Haeublein
33 2 2 7

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x380
x145
x32
x10

asked: Nov 01 '10 at 10:27 PM

Seen: 1507 times

Last Updated: Oct 10 '12 at 05:31 PM