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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

System.dll into WebGL build

Discussion in 'WebGL' started by r3dwolf, Jun 5, 2018.

  1. r3dwolf

    r3dwolf

    Joined:
    Feb 16, 2012
    Posts:
    39
    Hi,
    following this article https://docs.unity3d.com/Manual/ReducingFilesize.html I removed all reference to system.dll from my code to size down webgl build but from log i discovered that library is however in the build.

    I tried also with a empty project (only camera and a cube) and from editor log I get:
    Mono dependencies included in the build
    Dependency assembly - Mono.Security.dll
    Dependency assembly - System.Core.dll
    Dependency assembly - System.dll
    Dependency assembly - mscorlib.dll
    Dependency assembly - UnityEngine.UI.dll
    Dependency assembly - UnityEngine.Networking.dll
    Dependency assembly - UnityEngine.Timeline.dll
    Dependency assembly - UnityEngine.Analytics.dll
    Dependency assembly - UnityEngine.StandardEvents.dll

    It's a bug?

    I'm using 2017.4.4 LTS
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    It is a bug if you see symbols from those DLLs in the generated build, otherwise I would not worry about it. Managed code stripping should remove everything that is not used.
     
  3. r3dwolf

    r3dwolf

    Joined:
    Feb 16, 2012
    Posts:
    39
    Hi @Marco-Trivellato, how can i check if there are symbols from those DLLs in the generated build?

    Starting from the basic project above I also tried to add a reference to a class in the system.dll (Queue <T>) and the build has a variation of 3KB (uncompressed).
    So either the system.dll was also present in the initial version or striping is done inside the system.dll itself: In the latter case, however, it is something different from that in the documentation.
    Did I make any mistakes? In which of the two cases are we?

    I'm trying to make the webgl build as small as possible...
     
    Last edited: Jun 6, 2018
  4. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    If you know the symbols you are looking for you can:
    • make an asm.js development build
    • open the generated <buildname>.asm.code.unityweb file in a text editor
    • search for the symbol
    If you don't know the symbols, maybe a better approach is to use the build report tool:
    • make a development build
    • in the browser, open http://files.unity3d.com/build-report/
    • look at the stripping tab which will provide info about which Unity modules are included and their size.
     
  5. r3dwolf

    r3dwolf

    Joined:
    Feb 16, 2012
    Posts:
    39
    Hi, @Marco-Trivellato,
    thanks for your answer.
    I started from the basic project above with the script that uses queue <T> and Stopwatch (system.dll);
    I tried the tool http://files.unity3d.com/build-report/
    in the report does not appear neither "system" nor "queue" nor "Stopwatch"

    Instead, opening <buildname> .asm.code.unityweb obviously I find for example Stopwatch
    function _Stopwatch__cctor_m2429516881 (i1, i2) {
    i1 = i1 | 0;
    i2 = i2 | 0;
    ...
    but this does not tell me if the whole library system is contained in the build

    So i make another try and I realized that in a project that has queue but not stopwatch, in the build I do not find stopwatch (<buildname> .asm.code.unityweb). So unlike what is here https://docs.unity3d.com/Manual/ReducingFilesize.html striping seems also done inside the dll;
    can you confirm it?
    if so, you can use the classes you need, regardless of whether they are in the infamous system.dll
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    On IL2CPP-platforms, managed code is always stripped of unused symbols.