QualitySettings.SetQualityLevel in Unity 4.1.5f1 crash

Hello,

I’m currently investigating a bug I’m experiencing. The bug happens when i mid-game call QualitySettings.SetQualityLevel. This used to work on Android without problems when I used Unity 3.5.x, but now when I’ve upgraded to Unity 4.1.5f1 I suddenly see this. Unfortunately, the bug doesn’t happen on all devices. It happens on Samsung Galaxy Tab 10.1 and on Asus Transformer Prime tablet, but it doesn’t happen on Samsung Galaxy S2 phone or Google Nexus 7 tab.

I can’t see any other posts about this issue, so I’m not sure if this is a Unity bug or a bug in my code. But, after all, I would assume that calling QualitySettings.SetQualityLevel shouldn’t cause the app to crash all of the sudden?!?

Is anyone else experiencing problems with SetQualityLevel at runtime when using Unity 4.1?

The error I get reported from the device is the following:

java.lang.Error: FATAL EXCEPTION [GLThread 12459]
Unity version : 4.1.5f1
Device model : samsung GT-P7510
Device fingerprint: samsung/GT-P7510/GT-P7510:4.0.4/IMM76D/XWMPE:user/release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Build fingerprint: ‘samsung/GT-P7510/GT-P7510:4.0.4/IMM76D/XWMPE:user/release-keys’
Revision: ‘14’
pid: 17643, tid: 17658, name: UnityMain >>> org.flarup.sticks.freever <<<
r0 0173d5c4 r1 00000000 r2 00000000 r3 00000000
r4 01f8f4b8 r5 00000001 r6 00000004 r7 00000258
r8 00000000 r9 00000000 sl 01cde110 fp 01f91668
ip 00000000 sp 5cf46130 lr 57d1d327 pc 57df4808 cpsr 0000000b

at libGLESv2_tegra.0003d808(Native Method)
at libGLESv2_tegra.glDrawElements(glDrawElements:168)
at libunity.00385ccc(Native Method)
at libunity.00387480(Native Method)
at libunity.00205434(Native Method)
at libunity.0020549c(Native Method)
at libunity.001f8f6c(Native Method)
at libunity.00123b94(Native Method)
at libunity.00126620(Native Method)
at libunity.00127820(Native Method)
at libunity.00147d18(Native Method)
at libunity.0014f4bc(Native Method)
at libunity.00152bf4(Native Method)
at libunity.002a5474(Native Method)
at libunity.002a5dec(Native Method)
at libunity.003b1c38(Native Method)
at libunity.003b1cd8(Native Method)
at libdvm.dvmPlatformInvoke(dvmPlatformInvoke:112)

Thanks a lot in advance for all help.

Kind regards,
Uffe Flarup

yep, we found the issue with gl context recreate (which seems to happen in your case - e.g. switching msaa level)
it should be fixed in 4.2 (should be out really soon)

Thanks a lot for your very quick reply! I look forward to get the fix in 4.2.

Uffe

Hi again Alexey,

I’ve been testing this in 4.2.0 which just was released. While the code no longer crashes and Android when changing quality setting runtime, I easily noticed that some materials started to render incorrectly. I noticed the following:

  • Materials with diffuse shaders were rendered way too brightly.
  • Texture on material was changed.
  • Text rendered in TextMesh got corrupted (may be related to above issue).
  • Material was rendered completely black (could also be related to previous isue).

It seems to be changing anti-alising level at runtime that triggers the problems. Switching between quality levels that have same anti-alising level seems to be ok according to the testing I did with the new version of Unity.

Is this a known issue in 4.2.0 which will be fixed in the next update?

you can easily check all known issues - they are written in release notes 8-P
soo… bug report with repro project

Definitely still exists, I have 4.2 with a game on the Google Play Store doing the same thing and the first thing I do is check whether I need to change quality settings (which turns on anti aliasing).

I don’t have time to make a repro at this stage, removing the code will have to do…

java.lang.Error: FATAL EXCEPTION [GLThread 322]
Unity version : 4.2.0f4
Device model : TOSHIBA AT100
Device fingerprint: TOSHIBA/tostab03/tostab03:4.0.4/IMM76D/01.000072314:user/release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Build fingerprint: ‘TOSHIBA/tostab03/tostab03:4.0.4/IMM76D/01.000072314:user/release-keys’
Revision: ‘0’
pid: 10591, tid: 10606, name: UnityMain >>> au.com.oddgames.monstertruckdestruction <<<
r0 0347ffe0 r1 00000004 r2 00000258 r3 00000000
r4 014b59c0 r5 00000000 r6 00000004 r7 02a6d070
r8 00000001 r9 00000258 sl 02a6d0b8 fp 00000000
ip 5c8f4bf0 sp 5cb72080 lr 5c88dbd8 pc 5c8af428 cpsr 0000000b

at libGLESv2_tegra.00035428(Native Method)
at libGLESv2_tegra.glDrawElements(glDrawElements:168)
at libunity.003af8e0(Native Method)
at libunity.003b18e0(Native Method)
at libunity.00221cb4(Native Method)
at libunity.00221d1c(Native Method)
at libunity.00213a4c(Native Method)
at libunity.00134604(Native Method)
at libunity.00136fd0(Native Method)
at libunity.0013b9a8(Native Method)
at libunity.00144af0(Native Method)
at libunity.00164f1c(Native Method)
at libunity.00168f1c(Native Method)
at libunity.002c95e4(Native Method)
at libunity.002c9f98(Native Method)
at libunity.003f626c(Native Method)
at libunity.003f6310(Native Method)
at libdvm.dvmPlatformInvoke(dvmPlatformInvoke:112)

FYI: I submitted a reproducable project to them. You can follow the case here:

https://fogbugz.unity3d.com/default.asp?553399_06ke2dh63898u61e