- Home /
Android QualitySettings SetQualityLevel 3D corruption
When switching Quality Settings on Android the engine glitches / corrupts the 3d scene. The gui stays functional. Is there any way to detect and / or fix this?
I am using Unity Pro, though that should only improve quality right? ;-)
To reproduce:
create a simple 3D scene: light, shadows, texture on a cube, etc.
Add the script below
Add HDR bloom (have not tested other Image Effects yet but I suspect the same behaviour).
Build for android, push the gui button.
As soon as the Quality switches, the 3D rendering is corrupted. Reloading the scene does not help. Only force quitting the application restores functionality.
It seems the Quality Settings code is not cross platform compatible. I have the same issue on a HTC Desire HD a Tegra 2 and a Tegra 3 tablet.
Is there a way to get it to work with a workaround? Like a small bit of Android only code that handles the switch correctly?
public class Blah : MonoBehaviour { public int selectedQuality = 0;
void OnGUI(){ if (GUILayout.Button(QualitySettings.names[selectedQuality])) { selectedQuality ++; selectedQuality %= QualitySettings.names.Length; QualitySettings.SetQualityLevel(selectedQuality, false); //or true to reload the expensive stuff as well (textures, shaders, lod ? :S) // QualitySettings.SetQualityLevel(selectedQuality, true);
//Application.LoadLevel(Application.loadedLevel); //<-- does not fix the corrupted scene } } }
I tested the simple scene set-up, but this does not seem to have the issue. Add HDR Bloom and it will corrupt the scene.
I have also tried: QualitySettings.SetQualityLevel(selectedQuality, false); GL.InvalidateState();
It did not help.
Next I'll start checking if HDR bloom can be reinitialized.
Same here , but i think it's an issue ($$anonymous$$e without Bloom or something)