Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Uncaught Assertion failed: s_GlobalMetadataHeader - MetadataCache.cpp

Discussion in 'WebGL' started by _eternal, Nov 7, 2016.

  1. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    259
    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:

    Code (CSharp):
    1. Uncaught Assertion failed: s_GlobalMetadataHeader->sanity == 0xFAB11BAF, at: C:\Program Files\Unity\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp,154,Initialize at Error
    2.     at jsStackTrace (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1056:12)
    3.     at stackTrace (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1070:21)
    4.     at ___assert_fail (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:11731:207)
    5.     at __ZN6il2cpp2vm13MetadataCache10InitializeEv [il2cpp::vm::MetadataCache::Initialize()] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:4332665:42)
    6.     at __ZN6il2cpp2vm7Runtime4InitEPKcS3_ [il2cpp::vm::Runtime::Init?S(char*)] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:1129704:2)
    7.     at _il2cpp_init (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6319279:2)
    8.     at __Z24InitializeIl2CppFromMainRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_iPPKc [InitializeIl2CppFromMain?S(undefined?N?&)] (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6100756:2)
    9.     at _main (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:2955356:2)
    10.     at Object.asm._main (blob:http://scarletstringstudios.com/9c327443-e8ca-4c75-a9eb-8ed61d2912d6:6345084:20)
    11.     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.
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Does the webgl build work locally ?
     
  3. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello _eternal.

    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).
     
  4. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    259
    You're right, the cache was the issue. It worked when I created a new folder on the server. Thanks!
     
  5. mitchmeyer1

    mitchmeyer1

    Joined:
    Sep 19, 2016
    Posts:
    32
    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)
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I suggest enabling "File Names as Hashes" option in Player Settings so that the build files are unique for each build.
     
    mitchmeyer1 likes this.
  7. mitchmeyer1

    mitchmeyer1

    Joined:
    Sep 19, 2016
    Posts:
    32
    @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
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    You can find it in the Player Settings, but it's a 5.6 feature.