Changing quality setting on all scenes

I am making a game where I have an options menu in a separate class. I want the player to be able change the quality settings in game, so I use a toggle group and this line of code:
QualitySettings.currentLevel = QualityLevel.Fastest;

My problem is that when i change scene back to the game, the quality settings reset. Anny idea how to do this? I’ve tried to add:
DontDestroyOnLoad(transform.gameObject);

Now when I go back to the game the setting stay the same, but when I reopen the class to change something else, it resets.

Thanks

I had the same problem, you need to turn it into a variable.

#pragma strict

var quality = QualityLevel.Fantastic;

function start()
{
    QualitySettings.currentLevel = quality
}