Search Unity

URP adds 1.4MB to the (compressed) wasm code size

Discussion in 'Web' started by jfaust-fy, Feb 24, 2021.

  1. jfaust-fy

    jfaust-fy

    Joined:
    Dec 2, 2020
    Posts:
    5
    I'm doing some tests to figure out how small a package I can get to as a starting point for a web-based project. One of the things I've run into is a major difference in the generated wasm size for URP vs. the builtin render pipeline - seemingly having nothing to do with URP at all. To do this test I:
    1. Created a new 3D project with a cube and a camera (no collider on the cube)
    2. Set engine stripping to high
    3. Made a Release wasm build (shown below as builtin-renderpipe.wasm.br
    4. Installed URP (https://docs.unity3d.com/Packages/c...ersal@10.3/manual/InstallURPIntoAProject.html)
    5. Made another build (urp.wasm.br below)


    1576198 Feb 23 18:09 builtin-renderpipe.wasm.br



    2949806 Feb 23 18:12 urp.wasm.br


    Looking at the builds with the BuildReportInspector, I see:
    Builtin:
    builtin.png
    URP:
    urp.png

    There are a few differences, but the main thing I notice is the inclusion of the Physics and Physics2D modules, even though they're not being used.

    Has anyone else seen this? Is there something in URP that forces Physics to be included? Is there any way for me to force it to be stripped?

    Thanks
     
    De-Panther likes this.
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Discussing this with the Universal Render Pipeline team, the reason for this physics dependency is due to volumetric rendering features support, where the renderer needs to do physics queries to reason about the visibility and overlap of different Volume objects. There is unfortunately no current way to strip out this dependency, but this is a known issue in the URP team, and they do have plans to add support for stripping out the volume system from the renderer altogether.
     
  3. jfaust-fy

    jfaust-fy

    Joined:
    Dec 2, 2020
    Posts:
    5
    That makes sense - I guess I'll be sticking to the builtin pipeline for now. Thanks!