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

emscriptenArgs does not work in Unity2021?

Discussion in 'WebGL' started by OceanX000, Nov 14, 2021.

  1. OceanX000

    OceanX000

    Joined:
    Feb 24, 2021
    Posts:
    120
    Use the following code:
    BuildOptions option = BuildOptions.None;
    PlayerSettings.WebGL.emscriptenArgs = "-s TOTAL_MEMORY=256MB -s --profiling-funcs";
    BuildPipeline.BuildPlayer(GetScenePaths(), dst, BuildTarget.WebGL, option);


    Before 2021, "--profiling-funcs" would keep original function name in wasm. But it doesn't work now,functions in wasm file looks like this:
    (func $f398 (type $t4) (param $p0 i32) (result i32)
    (local $l1 i32) (local $l2 i32) (local $l3 i32)
    local.get $p0
    call $f716
    block $B0 (result i32)
    block $B1 (result i32)
    local.get $p0
    i32.load offset=48
    if $I2 (result i32)
    local.get $p0
    i32.load8_u offset=186
    i32.const 8
    i32.and
    i32.const 3
    .....
     
  2. MarcelPursche

    MarcelPursche

    Unity Technologies

    Joined:
    Mar 3, 2021
    Posts:
    44
    Hi,

    in Unity 2021.2 the option to keep original function names was added to the build settings. You can enable this by setting the "Debug Symbol Mode" to "Embedded" in the WebGL Player Settings or using the corresponding Scripting API: https://docs.unity3d.com/2021.2/Doc...nce/PlayerSettings.WebGL-debugSymbolMode.html
    Code (CSharp):
    1. PlayerSettings.WebGL.debugSymbolMode = WebGLDebugSymbolMode.Embedded;
    2.  
    This has the same effect as "--profiling-funcs".
     
  3. OceanX000

    OceanX000

    Joined:
    Feb 24, 2021
    Posts:
    120
    Thank you for this information, very helpful for us.
    But we still have related issue:
    If you choose External, it will cause compilation errors. Issue has been submitted before, but it has not been fixed for a long time. Our release version hopes to use external because it can reduce the code size.
     
    Last edited: Dec 9, 2021
  4. MarcelPursche

    MarcelPursche

    Unity Technologies

    Joined:
    Mar 3, 2021
    Posts:
    44
    I will raise priority for this issue with the team and post an update here.
     
  5. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,049
    How we could set other option such as
    MODULARIZE
    ?