I tried making a WebGL build of my game for the first time today, and I’m running into compile issues. The game is (supposed to be) here: http://scarletstringstudios.com/test_devbuild/
And here’s the error in my browser console:
Uncaught Assertion failed: s_GlobalMetadataHeader->sanity == 0xFAB11BAF, at: C:\Program Files\Unity\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp,154,Initialize at Error
at jsStackTrace (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1056:12)
at stackTrace (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1070:21)
at ___assert_fail (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:11731:207)
at __ZN6il2cpp2vm13MetadataCache10InitializeEv [il2cpp::vm::MetadataCache::Initialize()] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:4332665:42)
at __ZN6il2cpp2vm7Runtime4InitEPKcS3_ [il2cpp::vm::Runtime::Init?S(char*)] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1129704:2)
at _il2cpp_init (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6319279:2)
at __Z24InitializeIl2CppFromMainRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_iPPKc [InitializeIl2CppFromMain?S(undefined?N?&)] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6100756:2)
at _main (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:2955356:2)
at Object.asm._main (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6345084:20)
at Object.callMain (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6347275:28)
I’m not too sure what to make of that error log, but it looks like MetadataCache.cpp might be the problem. What is this file? Can I safely delete it, or clear Unity’s cache some other way? I don’t have any warnings or errors in the Unity editor, and the desktop build works correctly.
Issues related to the s_GlobalMetadataHeader->sanity normally occur when you have .data and UnityLoader.js coming from different versions (means the metadata is just being read from a wrong offset, which is taken from the mismatching loader). This normally happens when .js and .data files have different lifetime in the intermediate cache. So, when you update the build in the same server folder, you might end up with the old .js file and the new .data file returned from the server (see the related thread https://forum.unity3d.com/threads/issue-with-caching-and-webgl-builds-5-4.433974/)
By the way, the build from the link launches fine for me (just has a runtime error now: IndexOutOfRangeException: Array index is out of range).
I have an educational game that is implemented at dozens of schools. I keep getting this error report from clients/teachers for a few days after I push a new build. It’s a real problem for me. Is there any way you can think of to catch this error so that I can clear the client’s cache and refresh in js? (Unity 5.6)
@Marco-Trivellato I do not see this option. I also searched it online and the only result on google is this thread. Could you tell me where that option is? I should note I am actually on 5.5, not 5.6 in case that makes a difference