PlayerPrefs and QualitySettings issue

Hi,
i wrote a script for changing quality settings ingame, working fine.
Now i would like to save this settings in the with the playerprefs.
Saving an int in the player prefs, for example for the anti alising settings wirking fine, too.
I even can get this int back on starting the game.
But if i take this int and say in my script hey use the new value for the anti alising settings it just doesn’t.
I can see the value in the settings is changed but the anti alising in the game is at 0.
Here is how i do this:
Start the game, change the settings, click on safe, then the script saves the playerprefs.
(I can see the value changed in the registry).
I restart the game:
void start function checks the value and sets it to the new value.
In the settings i now see AA is 8x and nof “off” as at the first start.
It seems my script does not apply the nwe AA value to the Quality settings…
Anyone has some idea why?

Maybe a lil bit code here.

// These are the variables for setting and displaying the AA
// currentAA will be saved in the playerprefs later
private int[] setAntiAlising = {0, 2, 4, 8};
private string[] displayAntiAlisingSetting = {"Off", "2x", "4x", "8x"};
private int currentAA = 0;

// Saving the settings
if( GUILayout.Button( "Save", settingsButtonStyle ) ) {
	PlayerPrefs.SetInt( "currentAA", currentAA );
}

// load the settings
void Start() {

if( PlayerPrefs.GetInt( "currentAA" ) > 0 ) {
	currentAA = PlayerPrefs.GetInt( "currentAA" );

	 /**
	  * set AntiAlising to current AntiAlising status
	  */
	 QualitySettings.antiAliasing = setAntiAlising[currentAA];
	 Debug.Log( QualitySettings.antiAliasing );
}
else {
	currentAA = 0;
}

}

Hope u understand my problem, if not ill do some pics.

Assuming this line:

currentAA = PlayerPrefs.GetInt( "currentAA" );

… is properly retrieving an INT value (let’s say “8”), then this line doesn’t make sense to me:

QualitySettings.antiAliasing = setAntiAlising[currentAA];

That would be attempting to access the element at index 8 in the array - which doesn’t exist. I’d guess you want this:

QualitySettings.antiAliasing = currentAA;

Jeff

currentAA is retrieving int value thats right.
But it is the key of the array, the value that i get is 3. with the 3rd key i can access the int 8 value in setAntiAlising array to set the new AA level.
As i said this is working fine, unity just dies not apply this new settings to the environment.
here the pics:
settings done and saved

restart game:

Ah, yeah - got it.

I’d guess this might be interesting to you…

http://answers.unity3d.com/questions/47273/rendering-quality.html

Jeff

Ty for the reply. I dont know why, but it works fine now. i didnt change anything.
I tried it out a vew times again:
In the edidor it does not making any changes, it still dies not work to safe the quality settings and restarting the the game, the changes are not applied to the environment. But if i build the game and start it, change the settings, safe them and restart the game it works :slight_smile: