Unity WebGL x iOS 15.4 Workaround

Hi ZapWorks Community :zap:

I’m sure most of you are aware, Apple released their newest OS version this week - iOS 15.4. This update released some new features but also introduced a significant bug for Unity projects targeting WebGL.

WebGL is one of the main build platforms when using the Zappar for Unity package and if you’ve been testing on an updated iOS device over the past few days you may have noticed experiences infinitely loading / crashing.

We’ve been working with the Safari and Unity team to find a workaround and thankfully one has been found. See below:


:hammer_and_wrench: Workaround steps :hammer_and_wrench:

  1. Find the Unity installation:
    MacOS - Unity.app/Contents
    Windows - \Editor\Data\

  2. Edit: il2cpp/libil2cpp/metadata/GenericMetadata.cpp

  3. Find the line: const Il2CppType* GenericMetadata::InflateIfNeeded

  4. Add: #pragma clang optimize off to the line before that function to turn off compiler optimizations for the function.

  5. Add: #pragma clang optimize on after the end of that function to turn compiler optimizations back on again. This will disable compiler optimizations for that one function.

  6. In your Unity project, delete the directory Library/Bee/artifacts/WebGL/il2cpp to be sure it picks up the changes to that file.

  7. Also make sure your iOS Safari isn’t trying to load a cached version by going to Settings / Safari and selecting Clear History and Website Data.

  8. If you’re using Unity 2020, then you’ll want to delete the cache folder, found here: Library\Il2cppBuildCache


There’s a helpful thread on the Unity forum detailing this workaround and also a further conversation on the issue, here.

:information_source: There are still reports of some inconsistencies and various graphical glitches introduced in iOS 15.4 and we believe WebGL2 to be the root cause. If you’re noticing anything like this then we’d recommend enforcing WebGL1 and try testing again on iOS 15.4.

:information_source::information_source: In some cases, you’ll also need to ensure Player Settings → Publishing Settings → Enable Exceptions isn’t set to “None” (“Explictly thrown exceptions” seems to work well)

If you’re still experiencing issues when deploying a Unity project built with the Zappar for Unity package, please get in touch with us at support@zappar.com or on this thread.

George

5 Likes

A quick update for our users. We’ve been testing the UAR builds with new iOS 15.5 release and can confirm the wasm error of Runtime error: Out of bound memory access... to be fixed. So we recommend suggesting this update if it’s available in your region. And don’t forget to revert the changes you made to editor il2cppp script GenericMetadata.cpp.

Cheers,

Hi George! Any update? We still have problems with Iphones :frowning:

Hi @planmundo can you tell us a bit more about the issue you’re facing by emailing in to support@zappar.com?

Thanks!