Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Error building WebGL in 2021.2.5f1 - ebug_WebGL_wasm\build.js: undefined symbol

Discussion in 'Web' started by Meltdown, Dec 19, 2021.

  1. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,812
    EDIT : Resolved, it seems in Unity 2021 strict name checking was turned on for function references in .jslib files. So make sure all calls to DllImport do indeed have a matching case-sensitive function name in a .jslib file.

    There is also a '-s ERROR_ON_UNDEFINED_SYMBOLS=0' command line argument which may get around this issue.


    Code (CSharp):
    1. [DllImport("__Internal")]
    2.     private static extern void OpenRewardedVideo();
    I was building on Unity 2020 just fine, after upgrading to 2021, I now get this error...

    Code (CSharp):
    1. Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js: undefined symbol: openRewardedVideo (referenced by top-level compiled C/C++ code)
    openRewardedVideo resides in a .jslib script I have in Plugins/WebGL, I use it to call an openRewardedVideo javascript function in the web page hosting the game. The script .jslib script looks like this...

    Code (JavaScript):
    1. mergeInto(LibraryManager.library, {
    2.   OpenURL: function (url) {
    3.     window.open(Pointer_stringify(url), '_blank');
    4.   },
    5.   OpenRewardedVideo: function () {                      
    6.     openRewardedVideo();
    7.   },
    8.   OpenInterstitial: function () {                          
    9.     openInterstitial();
    10.   }
    11. });

    Thanks
     
    Last edited: Dec 21, 2021
    MadeFromPolygons likes this.
  2. Laaevin

    Laaevin

    Joined:
    Sep 10, 2012
    Posts:
    10
    I just started getting this error and it is driving me crazy. Can you please clarify how I implement your solution?
     
  3. nat-soragge

    nat-soragge

    Joined:
    May 15, 2013
    Posts:
    8
    For those wondering how to use the '-s ERROR_ON_UNDEFINED_SYMBOLS=0' argument:
    • Go to ProjectSettings folder and open ProjectSettings.asset
    • Search for webGLEmscriptenArgs
    • Add the argument in front of it, like
      webGLEmscriptenArgs: -s ERROR_ON_UNDEFINED_SYMBOLS=0
    That solved the issue for me
     
    Jimaniki, Masegi and nonemec like this.
  4. kamranasad7

    kamranasad7

    Joined:
    Oct 14, 2022
    Posts:
    1
    Hey. I am having the same problem after upgrading from Unity 2022 LTS to 2023. My function names are case sensitive. I have tried deleting the Library folder too. And I have also tried the above solution of adding webGLEmscriptenArgs but none is helping.
     
  5. Jimaniki

    Jimaniki

    Joined:
    Nov 9, 2017
    Posts:
    20
    That works for me ! Thank you so much !
    i had try so much solution read on differents forums before whitout success until that.