How can I select a graphic api at runtime?

The problem is again android. Some (too many) users report fatal crashes (black screen, need expert to repair phone) because the vulkan api is killing some hardware. it seems opengl is working way better, but it produces less acurate rendering with the crest ocean.
so i would like to let the user choose, if he dares to crash the device.

i am getting mad - we make 25% revenue with android compared to ios and have to spend 90% of time troubleshooting.

It’s possible to do that:

hm, this is the solution? :sunglasses:
Unity 2019.3 introduces an Android specific solution that allows you to change Graphics APIs and threading modes very early during startup using standard Unity command line arguments. It’s still not very convenient because you will have to write custom Java code to do that, but it’s a solution.
honestly? so, what kind of custom java code should I put where? :eyes:
I would rather not fiddle arround with any java. I am currently on V2019.3.9 - should I update to 2020.1 ? Will Vulkan not kill android devices then? :wink:

This is the only solution that is currently available.
I’ll poke @florianpenzkofer about what kind of java code one needs to write.

You could first try to update to the latest 2019.4. It has more bug fixes that what you’re on right now.
Bug fixes usually get to LTS versions if the fix is not too risky. But I cannot guarantee anything regarding “it will/will not work”.

Check Unity - Manual: Extend the default Unity activity (the part about specifying command line args).

1 Like

@Kobald-Klaus If you have any particular Android device, Android version, Vulkan driver version etc that causes many issues then please let us know :). We could change the defaults.

@florianpenzkofer
I see a lot of these crash reports for huawei. vkCreateImageView I assume is caused by vulkan but I don´t know.
The user who had to bring his device to “repair” has a Redmi 9 with Android 10.
Another Crash on Samsung Galaxy S10 - no details from the user.
this are some reviews:
Galaxy A41: “After every start the mobile phone hangs up and has to be restarted”
Huawei nova lite: “The game does not open”
Huawei M3: “Does not start”"

this is one log:

Version ‘2019.4.9f1 (50fe8a171dd9)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘arm64-v8a’
Build fingerprint: ‘HUAWEI/AGS2-W09EEA/HWAGS2:8.0.0/HUAWEIAGS2-W09/317(OCEC431):user/release-keys’
Revision: ‘0’
ABI: ‘arm64’
Timestamp: 2020-09-09 08:24:59+0200
pid: 5633, tid: 5654, name: UnityMain >>> com.sfinxit.dyb <<<
uid: 10303
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x70
Cause: null pointer dereference
x0 0000000000000001 x1 0000007e0fea5638 x2 0000007e0fea5600 x3 0000007e0fea5548
x4 0000007e0fea5528 x5 0000000000000000 x6 0000000000000000 x7 000000000000004e
x8 0000000000000000 x9 0003020100050403 x10 0000007e0fa18d48 x11 0000000000000007
x12 0000007e0fa18d88 x13 0000000000000018 x14 000000017de27000 x15 0000000000000000
x16 0000007e327cecb8 x17 0000007e3276c948 x18 0000007e0fea52b0 x19 0000007e0fea5528
x20 0000007e0fea5548 x21 0000007e09cc1420 x22 0000000000000001 x23 0000007e09c4a980
x24 000000000000002b x25 0000007e0fea5638 x26 0000000000000001 x27 0000000000000000
x28 0000000000000000 x29 0000007e11472600
sp 0000007e0fea54a0 lr 0000007e2059e5b4 pc 0000007e2059e5d0
backtrace:
at .
at .vkCreateImageView
[…]
at libGLES_mali.0x7695d0 (Native Method)
at libGLES_mali.vkCreateImageView (vkCreateImageView:164)
at libunity.0x72b560 (Native Method)
at libunity.0x73f3ec (Native Method)
at libunity.0x73f948 (Native Method)
at libunity.0x73fbb4 (Native Method)
at libunity.0x72495c (Native Method)
at libunity.0x7247fc (Native Method)
at libunity.0x70dca8 (Native Method)
at libunity.0x650d24 (Native Method)
at libunity.0x650fa4 (Native Method)
at libunity.0x63cbec (Native Method)
at libunity.0x6517d4 (Native Method)
at libunity.0x63e950 (Native Method)
at libunity.0x63f36c (Native Method)
at libunity.0x6531ac (Native Method)
at base.0x8f9c (Native Method)

We have a similar crash in vkCreateImageView on old Mali Vulkan drivers. Issue is Unity Issue Tracker - [Android][GLES3] Crash on Samsung Galaxy J5 after launching gfx tests.
Working on a fix for this.

1 Like