Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug WebGL Build Error

Discussion in '2022.1 Beta' started by rreiss1208, Sep 23, 2021.

  1. rreiss1208

    rreiss1208

    Joined:
    Sep 23, 2021
    Posts:
    1
    Hello Unity Forums!

    I have been jumping through a lot of hoops to get my Photon project working in the newest versions of Unity, and I am so close to having it work, but am stuck with a bug I am currently having on build. No errors are showing up in the console while running in editor, but as soon as I try to build to WebGL, I get 11 errors in my console. The main errors contain info saying stuff like: "Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js: undefined symbol: SocketClose (referenced by top-level compiled C/C++ code)"

    I was able to build to WebGL before, so I know it's not a problem with the code in the project, and also the errors are talking about the Library/Bee destination.

    I am not too good at debugging errors that don't involve c# code, so if there is anyone that understands these errors, please help me out! Any help is very much appreciated. Attached below is a pastebin filled with the errors that I received in my Unity Console on build (taken from the editor log). Thank you for your help! And please let me know if I can provide any more info.

    https://pastebin.com/AKcpXnQt
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Try deleting the Library/Bee folder - so far that's resolved every error I've had that started with the words "Library/Bee".
     
    ProGameDevUser, laelson and C1wan like this.
  3. SpotDev

    SpotDev

    Joined:
    Mar 22, 2014
    Posts:
    1
    WORKED
     
    C1wan, zhengyi73 and adamgolden like this.
  4. Aunkon

    Aunkon

    Joined:
    Feb 6, 2016
    Posts:
    2
    Not Working for me on Unity 2021.3.1f1-LTS
     
    vivekgorrepati likes this.
  5. vivekgorrepati

    vivekgorrepati

    Joined:
    Apr 21, 2019
    Posts:
    1
    Not working for me as well any solution ?
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    do you have some plugins in the project?

    i had same error, caused by asset store plugin and the fix was to update it (developer had made some fixes related to webgl 2)
     
  7. john_primitive

    john_primitive

    Joined:
    Jan 4, 2019
    Posts:
    7
    The Bee folder regenerates automatically, so this is not a solution for Unity 2022. Curious if any progress is being made here
     
    Laaevin likes this.
  8. Laaevin

    Laaevin

    Joined:
    Sep 10, 2012
    Posts:
    10
    I'm encountering this issue all of a sudden now. I've tried updating all of my assets as well as my version of Unity, but I'm still getting the error when I try to build. Has anyone found a solution?
     
  9. guilhermelucio

    guilhermelucio

    Joined:
    Apr 6, 2022
    Posts:
    1
    has anyone got any progress on this matter? In my case deleting the bee folder wasn't enough
     
  10. inyourpc

    inyourpc

    Joined:
    Jul 14, 2013
    Posts:
    9
    yes same issue with me, my unity version is 2021.3.0f1
     
  11. cbaltingok

    cbaltingok

    Joined:
    Sep 5, 2022
    Posts:
    1
    I had the same issue and solved it by fixing the .jslib file extension name. I enabled the file extensions in finder's preferences and found out there is an extra .js extension at the end, once i fixed the naming i no longer received the error we are all getting mentioned above. Hope this fix your issue as well. Naming should be [yourFileName.jslib] under the Plugins folder as a sub
     
  12. the_aia

    the_aia

    Joined:
    Feb 8, 2020
    Posts:
    7
    I was making WebGL builds fine and then all of a sudden started getting this error.

    Using Unity 2022.1.0b9.2778
    I tried...
    • closing the project -> deleting the Library/Bee folder -> reopening the project (which regenerates these files). this did not work
    • closing the project -> deleting the entire Library/ folder -> reopening the project (which regenerates these files). this did not work
    Full error:

    Code (CSharp):
    1. Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js: undefined symbol: _ZN4FMOD12ChannelGroup21getAbsoluteAudibilityEPf (referenced by top-level compiled C/C++ code)
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  13. maldeirra

    maldeirra

    Joined:
    Aug 26, 2015
    Posts:
    4
    Hello Everyone,

    I have the same bug but this help me : https://github.com/Siccity/GLTFUtility/pull/203

    I don't know if you have this bug because of the use of "GLTFUtility" but even if not it will perhaps help you find a solution.

    The steps was :
    1) delete the draco plugin folder
    2) install new version of draco
    3) rewrite some code to adapt to the new draco.

    I hope this'll helps you =)
     
    TheS1rius likes this.
  14. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    397
    Has anyone found a reason for this error?
    I get the same error when building on 2022.1.6.

    Deleting the library does not help and I don't have GLTFUtility in the project.

    When I downgrade to 2021.3.11 the building works
     
    Last edited: Oct 13, 2022
  15. Blenderik

    Blenderik

    Joined:
    May 14, 2013
    Posts:
    146
    1. Check the assets folder for a file with the extension .jslib.
    2. Check your code for [DllImport("__Internal")]

    For example for me the error occured because of this line:

    Code (CSharp):
    1.     [DllImport("__Internal")]
    2.     private static extern void sendString(string state);
    the sendString method must be declared in a .jslib file, otherwise compile will fail. This is the method to communicate with the html page that replaced Application.ExternalCall, so without the app being in a container of a website, the code does nothing and will not throw an error in the editor.
    Hope that helps.
     
  16. GertCoppens

    GertCoppens

    Joined:
    May 2, 2018
    Posts:
    12
    Any update on this?
     
  17. PHARTGAMES

    PHARTGAMES

    Joined:
    Jan 30, 2013
    Posts:
    5
    I have the same issue after upgrading from 2020.3.30 to 2022.1.20

    After I deleted my entire library folder I was able to build however after building addressables it broke again.

    is there a bug in the issue tracker for this?
     
  18. Laaevin

    Laaevin

    Joined:
    Sep 10, 2012
    Posts:
    10
    So, when I start a brand new project from scratch, I am able to build it without any problems several times.

    Then, seemingly randomly, I'll start getting this error. (Actually, usually Unity is throwing around 26 related errors when I try to do a WebGL build.) When I switch over to another platform, the errors aren't thrown, but when I switch back to WebGL it immediately returns. Here is what I've tried:

    1. Closing the project, deleting non-essential folders (Library, Logs, previous Build attempts, etc.), then restarting the computer and then opening the project and attempting to build. (This worked once with one project.)

    2. Closing the project, deleting the aforementioned files, creating a copy (Ctrl C, Ctrl V) of the project and opening the "new" project from the Hub. (This worked once with one project.)

    3. With a game with a single scene, exporting the scene as a Unity package, creating a brand new project, importing the package, then building. (This worked once with one project.)

    4. I have tried reimporting all packages and doing a clean build. This hasn't seemed to help.

    5. Trying all the above, then googling some more, than restraining myself from putting my keyboard through the monitor. Still hasn't worked. If anyone has any more ideas, I'd love to hear them! I'm currently using 2022.1.13fl on Windows 10.

    Again, this is an intermittent problem that only emerges after several successful builds with WebGL, with nothing noteworthy different between the build where the errors begin and previous builds that had no errors, so troubleshooting is a bugger.
     
    Last edited: Nov 12, 2022
  19. Laaevin

    Laaevin

    Joined:
    Sep 10, 2012
    Posts:
    10
    I finally found a solution that seems to work (at least so far).
    In the Inspector, under Assets, delete the WebGLSupport folder.
    This will trigger various warnings about stuff missing, but it allows the build to succeed without errors!
    Not sure why this works, but it does seem to work.
     
  20. FS9606

    FS9606

    Joined:
    Mar 12, 2015
    Posts:
    21
  21. MushyAvocado

    MushyAvocado

    Joined:
    Oct 16, 2021
    Posts:
    20
  22. gareth_untether

    gareth_untether

    Joined:
    Jan 5, 2018
    Posts:
    69
    To fix the bug I had to delete an old script that was in the Assets folder. The script was not in any of the scenes.
     
  23. MattuWalk

    MattuWalk

    Joined:
    Apr 10, 2018
    Posts:
    2
    I spent hours on this. Deleted the whole WebGL plugin folder and removed all [DllImport("__Internal")] plugin code but nothing helped. Every build ended up with error at:

    acorn-optimizer.js:1845

    I solved this in the end by downgrading from 2021.3.20f1 to 2020.3.14f1 and then had to clean the GI Cache (button on GI Cache page in edit preferences).
     
  24. Bonnate

    Bonnate

    Joined:
    May 30, 2021
    Posts:
    5
    1. Make sure the .jslib file is in the Plugins folder.

    2. When writing a .jslib file, check if it is written in the following syntax. I solved it using this.
    Code (JavaScript):
    1. mergeInto(LibraryManager.library, {
    2.  
    3.     your function here..
    4.  
    5. });
     
  25. Oberheim

    Oberheim

    Joined:
    Jun 4, 2020
    Posts:
    24
    Same error please help !
     
    ProGameDevUser likes this.
  26. richardNXRT

    richardNXRT

    Joined:
    Aug 4, 2022
    Posts:
    26
    this fixed the problem for me!
     
  27. DTsoukalos

    DTsoukalos

    Joined:
    Jul 11, 2019
    Posts:
    8
    I had the same problem with my project in Unity version 2021.3.19
    I update my project to version 2021.3.28 and now is working fine!
     
  28. Nashet

    Nashet

    Joined:
    Nov 8, 2016
    Posts:
    2
    Check uppercase or lowercase letters for your methods. It helped me. Like here
    Code (CSharp):
    1. [DllImport("__Internal")]
    2. private extern static void [B]OpenWindow[/B](string url);
    and here
    Code (CSharp):
    1. var OpenWindowPlugin = {
    2.     [B]OpenWindow[/B]: function(link)
    3.     {
    4.         var url = Pointer_stringify(link);
    5.         window.open(url,'_blank');
    6.     }
    7. };
    8.  
    9. mergeInto(LibraryManager.library, OpenWindowPlugin);
     
  29. wintekms

    wintekms

    Joined:
    Dec 23, 2022
    Posts:
    1
    Same error please help !
    notting .jslib.
     
  30. MuYankang

    MuYankang

    Joined:
    Mar 2, 2018
    Posts:
    2
    If there is a code annotationin your jslib script, delete it and it will run.

    Code (CSharp):
    1. mergeInto(LibraryManager.library, {
    2.     debug: function(message){
    3.         console.log(UTF8ToString(message));  // log      <----- delete
    4.     },
    5. }
    Delete //log
     
  31. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,810
    Well done for hijacking a thread

    Other than that your error is exceptionally clear

    OUT
    OF
    MEMORY
     
  32. ks1an

    ks1an

    Joined:
    Mar 8, 2021
    Posts:
    3
    Updating Unity from version 2022.3.16f1 to version 2022.3.19f1 helped me
     
  33. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    The error occurs because your C# code is referring to an extern method that executes Javascript code in the web browser it can't find...

    Example for a method called OpenURL

    Code (CSharp):
    1. using System.Runtime.InteropServices;
    2.  
    3. [DllImport("__Internal")]
    4. private static extern void OpenURL(string url);
    If I add this to my code, and compile, I will receive the error.
    However, if I create a file named utils.jslib in my Assets/Plugins folder, the error goes away.

    Code (JavaScript):
    1. mergeInto(LibraryManager.library, {
    2.   OpenURL: function (url) {
    3.     window.open(Pointer_stringify(url), '_blank');
    4.   }
    5. });
    Note : The name and case of my OpenURL method in my C# code must be identical to that of my method in my .jslib file.

    If your code 'suddenly stopped working', it's because older versions of Unity were case insensitive, but a change in the past couple of years made this lookup case sensitive.

    Your .jslib file can be named anything, it doesn't matter, as long as the extension is .jslib it will work.
     
    Last edited: Mar 15, 2024
    Saeed-Barari likes this.