Search Unity

WebGL builds for mobile

Discussion in 'Web' started by Johannski, Aug 18, 2018.

  1. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Yeah, that's true, but I didn't find a good way for debugging on Android and not everyone has an iPhone and Mac at hand. With the debug console, that can be accessed from the device it is quite a bit easier (at least for me). Still a good foot note for everyone debugging in the apple world :)

    @Haru_Happy You can customize all of that with the WebGL templates: https://docs.unity3d.com/Manual/webgl-templates.html
    My custom template allows for the on screen debug console and a minimalistic clean experience. Maybe it would make more sense for you, to take the default template as a basis for your use case.
     
  3. oharinth

    oharinth

    Joined:
    Jul 8, 2015
    Posts:
    25
    I think you can modify index.html and css files in WebGL build folder.
    And may be unity logo will not be html or css issue. it will be unity issue. As I know, unity logo could not be changed in free version.
     
  4. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Another version, another test: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/2021.2.0f1
    Build time got quite a bit better (at least I feel that way), but there are a few caveats when switching to 2021.2:
    Build size also improved, especially for the default builds. Loading times seem to be better as well, I'm still not sure what the best way is to measure this...maybe I find the time to create a small control script that opens the website and waits for a console log message when Unity is started.
     
    kenshin likes this.
  5. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
  6. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Nice little feature update:
    I created a quite simple script to be able to access unity functionality from the browser console.
    The basic command is `unityGame.SendMessage("WebGL", "COMMAND_NAME",PARAMETER)`, e.g. `unityGame.SendMessage("WebGL", "SetTimeTimeScale",2)` to run the scene with double the speed. The current commands can be found here.

    Release notes:
    https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/2020.3.23f1

    Did anyone manage to run Unity WebGL with WebGL 2 on an iPhone? I thought with iOS 15, this should be supported by default, but with the 2021.2 I was not able to get it up and running.
     
    vb2s360 likes this.
  7. Cirtoyt

    Cirtoyt

    Joined:
    Dec 11, 2019
    Posts:
    4
    Hi Haru, I'm also currently looking into such methods and I came across this very nice tutorial here that shows you what code you need to edit to create a custom loading bar:


    Hope this helps!
    -Cirtoyt
     
  8. Deleted User

    Deleted User

    Guest

    First thank you very much Johannski for sharing your stuff, too bad i didnt find this thread earlier ;)
    Feels like i worked in parallel to you quite a bit in the past.

    I am currently looking into:
    The smallest possible entry payload for unity3d WebGL while having all the unity glory at hand.
    Where unity glory in webgl for me is: urp, postprocessing, "some c# capabilities".

    My goal is a visually appealing interactive entry point from where to load further assets.

    You mentioned urp gave you a +2.5mb, I am interested in your absolute.

    My 2020.3 test scene setup and numbers:
    * Camera (URP with some postprocessing)
    * 1 Light and a Cube
    * Graphy (quickly get UI & well done c# code in)
    * using System.Runtime.InteropServices; for JS communication
    * build for size, high stripping, brotli, .net4, no debug/stacktrace etc.

    Result is ~ 5.1 megabytes.

    Variations in the Build that get me closer to my final use case:
    using System: += 0.25MB (events via: static event Action)
    Build for Speed instead of Size: + 0.5 MB

    So I am at about 6mb total WebGL build payload now for my minimal requirements.

    And i assume it will grow with adding adressables all the logic dependencies (system dlls punch in with 10mb in another not-optimized project).

    Can you confirm the 5mb for your journey, or did you find a way to get even smaller?
    Some people mentioned <3 MB builds, but i doubt they were utilizing URP.[/QUOTE]
     
  9. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Hi @vam-digital,
    very interesting to read about your results and that we're not far apart from each other (I guess this speaks for our tests to have hit some limit).
    Yes, my URP builds are around 5.5MB (See https://github.com/JohannesDeml/UnityWebGL-LoadingTest#urp).
    That is, without Post Processingand built for speed. The smallest results I got are 2.43MB (with built for size without stack traces and the builtin pipeline).
    I added a small logic wrapper around the project to easily access the logs in a html console and to access common unity functions and the debug template also has a bit of overhead, but I guess it is not more than 10-20KB (haven't really measured it so far).
    Another thing to keep in mind, is that my builds are currently WebGL 1 only (since webGL 2 still does not work properly for me on iOS15).

    One thing apart of size I'm really interested in, is the loading times. I'm currently looking into measuring those in a CI step, to run it multiple times to get some stable data. But I'm only doing this as a hobby project, so it might take some more time.
     
  10. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Aloha nice people!



    Just wanted to give you a small update on what happened to the project in the last months:
    • I added Game CI to build directly with Github. This is nice, since it will save me time in the future, and you can directly see the output log and resulting build in the actions section. It is also cool for people who fork the project, that they already have some CI included :)
    • I built a project with Selenium to be able to measure loading times of the WebGL builds (https://github.com/JohannesDeml/SeleniumLoadingTracker). For that, I'm running the loading tests multiple times to get stable averages. This will add more information about the different unity versions, to not only make the decision on the resulting size, but also on the time it takes to load the site.
    Sadly I haven't managed so far to include the loading tracker in the github CI logic (I have problems with running a headless selenium browser with WebGL support in docker). If anyone wants to help me out here or has any suggestions, let me know :)
     
    andreibosco likes this.
  11. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Finished the new builds for 2021.3: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/2021.3.0f1
    • All builds (except for URP WebGL 2 on android) don't work on mobile. Seems like they broke something with 2021.3.
    • Default build with speed settings now got quite small with 2.54 MB
    • I somehow didn't manage to get a smaller build for minsize than for default, I feel like there is still some quirks with the builds with a clean library folder or a filled one
    • The URP build with WebGL 1 had shader compile errors (similar to 2021.2, even though they claim to have fixed them) - I already created a bug report
    • The URP build with WebGL 2 works, but is quite a bit larger with 5.80 MB
    • I also had some problems with CI builds, which I didn't have before

    For those reasons, I would not currently recommend to update to the new LTS version, especially if you want to target WebGL builds for mobile.
     
    Last edited: Apr 25, 2022
    henriqueranj and blueivy like this.
  12. TKOBro

    TKOBro

    Joined:
    May 10, 2022
    Posts:
    1
    Hi Mr.Johannski,

    I've read your thread and it's very useful. Now I got stuck on my WebGL project so it's time to request you help::))

    Here is summary information for the Game.
    1. WebGL Game : Virtual tour(360 Jpg Photo) + 10 Quest to clear 2. After player finish all
    2. 10 Quest included -> 3 Minigame quest + 7 Collect information quest(Just click on the photo to clear the quest)
    3. Mini game included -> Simple shooting game 10 point to win + Simple jigsaw game(Drag and fill blank space) + Simple Choosing the right photo game.
    4. After clear all the quest, user have to answer 3 questions to win the game.
    5. The game has the Register system and Create user character system (M/F, Head x6 type, Body x6 Type)

    The main problem I got
    1. Almost version of iOS are not work. (User can register and customise their character but when click to start the virtual tour to play the game, browser refresh itself to the homepage of the game.)
    2. From 1. Me and my friends used to restart our test phone and sometimes we can access and play the game until the end (But it’s very randomly happen)
    3. Some iOS device can play but got the blink bug on screen (playable but not a good experience)

    I have tried optimised and now build size is around 40 MB. - -“
    So what I gonna do next is to do “Unitywebrequest” (Upload some asset to CDN).
    (Never try it before so want some suggestion or guid to do it to save time )

    The question is do you think it’s gonna work or not? And do you have any suggestion for me to try.
    Thank you so much in advance:)))
     
  13. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Updated builds with 2021.3.6f1 and 2022.1.8f1:
    • For 2021.3.6f1 everything works again, no more shader compile errors
    • For 2022.1.8f1 the combination with URP and WebGL 1 does not work anymore, but since WebGL1 is deprecated, this is not too surprising I guess
    • I made WebGL 2 now the default in the project settings, since I feel it is now the better choice to develop for
     
    henriqueranj likes this.
  14. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Heya lovely people,

    I made some nice little improvements to the project:
    • Add unity debug log <color> support for browser and html console
    • Add html console input field for running javascript directly from there (such as running unity bridge commands, but can be anything really)
    • Cleanup folder structure and add assembly definition - makes it easier to pull this out into other projects
    Especially when you have a lot of coloring in your debug logs, this makes everything nicer, since you don't have the raw rich text in there anymore (with all the color tags), but have colored output (The javascript console is quite cool, even though the syntax to color style multiple elements is strange).

    Also the input field should be helpful for browser debugging, since you can call whatever javascript you want from there.
    Latest release: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/2021.3.13f1
    chrome_9MCoddRzcw.png
     
    yty and blueivy like this.
  15. dnach

    dnach

    Unity Technologies

    Joined:
    Mar 9, 2022
    Posts:
    89
    Regarding the second bullet point, we are now working to fix a URP regression (introduced in 2022.1) when targeting WebGL 1. That being said (and as you suggested) we do recommend targeting WebGL 2 moving forward.
     
    DannyWebbie likes this.
  16. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Thanks for tackling this problem! I just finished building everything for Unity 2022.2.0f1 and the problem still persists there, but I guess you are aware of that (https://deml.io/experiments/unity-webgl/2022.2.0f1-urp-webgl1/)
    Code (CSharp):
    1. Texture creation failed. 'ShadowAuto' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    Also, I want to note, that since Unity 2021.2 there is a problem with the combination of WebGL2 with builtin render pipeline for iOS. Here is more detail to the problem:
    Reproduction steps:
    If you want to reproduce the problem by building yourself, you can find the complete source code here: https://github.com/JohannesDeml/UnityWebGL-LoadingTest
    1. Use an iPhone or iPad and open Safari
    2. Open a webgl2 build from the list here: https://deml.io/experiments/unity-webgl/
      e.g. https://deml.io/experiments/unity-webgl/2021.2.19f1-webgl2 or https://deml.io/experiments/unity-webgl/2022.2.0f1-webgl2/
    3. Notice that the screen stays blank after the game has loaded (and Awake and Start times appear in the top left corner). Tap the round button in the top right to open up a html console to see the errors.
    Expected behavior:
    The game should start similar to when opening those builds on a desktop machine or on android. Only the combination WebGL2 and builtin renderpipeline is affected (which I guess is a quite popular one).

    I didn't post a bug report so far, since mobile was not really officially supported until 2022.2. @dnach Should I do this now, or is this post enough for you to track the problem?

    Update for Unity 2022.2.0f1 (https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/2022.2.0f1):
    • Building for WebGL1 with URP still has problems as mentioned before, all other combinations work.
    • Build size increased ~200KB on builtin and ~400KB on URP builds - Might be interesting to see, what Impact this has on bigger projects (if it is just an addition of 200KB, or if this scales with the total build size)
     
  17. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    Your builds all work on my browser! Amazing!
    None of your projects, if I compile myself in 2022.2.1f1 does not work at all!
    I only built your main scene and altered nothing else and did not use Unity Publish.

    I just did a straightforward build.

    See result
    https://itch.io/embed-upload/7185825?color=333333
     
  18. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    While you should not feel obliged: a minimal project with no extras for 2022.2.1f1 with your setting would be much appreciated.
     
  19. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    I see you already built my project for itch.io? From what I can see in the console, the problem is brotli compression not being supported / recognized (You can find this information in the console, or by clicking on the white circle in the top right):
    Code (CSharp):
    1. Unable to parse Build/WEBGL.framework.js.br! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: br" present. Check browser Console and Devtools Network tab to debug.
    From googling, I guess brotli is not yet supported by itch.io, and you should use gzip instead: https://itch.io/post/1987680
    You can change that in the player settings. The brotli compression is a bit stronger and therefore results in smaller build sizes, but the difference is not too big, so I think this should work for you :)

    Edit: Small additional note. Since you want to build for 2022.2, you should use the matching branch, so https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/2022.2 if you want to use the builtin renderpipeline or https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/2022.2-urp for urp - if you haven't done so far :)
     
    darashayda likes this.
  20. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Johannski much much gratitude, I will test tonight and tomorrow with one of my engineers.
    If we could do these WEBGL builds ourselves lots and lots of newbies will enjoy the builds and learn a lot.
     
  21. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    and we will acknowledge your good name.
     
    Johannski likes this.
  22. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Heya,

    some bigger updates on the repo:
    You can find the new release here: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/1.0.0
    These changes should help me doing less manual work for new builds.

    @dnach I'm still seeing problems with builtin renderpipeline and WebGL2 on iOS - sometimes the canvas does not render at all (even though Awake and Start are called), and sometimes it renders but has bad performance. Should I create a ticket for that, or are you aware of that problem?
     
  23. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    https://itch.io/embed-upload/7225292?color=333333

    My note of gratitude to you @Johannski !!! Much admire your giving generous spirit, and I hope it rubs off on all of us here and at Unity :)

    I went through your git and it is grade A+ development and management with much passion glowing bright.

    I really recommend to Unity corp and moderators of these forum to consider you for professional contribution and hope my words are spelled politely. We really need professional work such as yours and befits the status of Unity.

    You just below life to a WEBGL project otherwise was about to be canceled.

    Dara
     
  24. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    I rebuilt your projects and they are now running on iOS on Safari and on Android on Chrome.

    I was not able to get these builds run on IOS Chrome and FireFox which is quite odd!

    Dara
     
  25. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Thanks for the nice words and praises, I'm glad my project helped you and you find value and inspiration in it!

    Huh, very interesting! I had a look at my live builds and noticed too, that for Chrome on iOS the game would not load (just showing an empty progressbar and only the first log message in the console with nothing happening afterwards). This was a problem for me on Unity 2022.1.x & 2022.2.x. Builds with 2021.3.x did work right away. Interestingly after killing chrome and starting it again, all of the builds worked. For Firefox I didn't encounter the problem.

    Which combination of build, webgl version and render pipeline are you targeting? And does killing the browser app and restarting it also fix the problem for you? Very strange, I guess I will need to make notes in the readme for more awareness, would be good to have this reproducible. Please also note your iOS version and device, maybe I can reproduce it better there.
     
  26. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Johannski

    On iOS the builds, per your specs, are not working on both Firefox and Chrome but do work on Safari , which this time circumstances are reversed!

    iOS
    16.2

    FireFox
    109.0(25841)

    Chrome
    109.0.5414.83

    Sorry for late reply, was swamped with a never-ending release.

    I will catch up with you on your site to not burden the Unity forums ;)

    Dara
     
  27. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Thanks for the reply, but I think I would need more info to reproduce:
    • Which version where you targeting (e.g. 2022.2.2f1 with WebGL 2 Builtin Renderpipeline)?
    • What Device are you using?
    • Did you try to kill the app and start it again?
    • Did you try to restart your phone and then start the browser?
    I think it could be a memory problem, therefore especially restarting the phone would be interesting. Once I have the information I can try to reproduce the problem and note the specific issue on the github readme.
     
  28. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Johannski Terrific news the culprit for malfunction at load time was not due to your setup instructions, rather the Shaders not always load at run time for 2022.x ! In our application , the textures and possibly the shaders are streamed and loaded at runtime. Not loading due to build not including all shaders!

    Shader Variants need to be used with much care in order for WebGL build to include shaders. What happened was the same app was working on OSX and other OS , but new versions of Unity ,and for WebGL in specific, is careful/strict about shader inclusion in the builds due to large binary sizes, and the programmer needs to explicitly include them.

    I had to move to 2022.2.5f1 to make sure all the pieces fit together. Your instructions were preserved and all worked!

    For a demo to check for the build (I have removed the extras for narrowing down the problem), for now on desktops browsers through works on mobile browsers but the Touch input is missing and writing it now:

    (No promotion nor solicitation is intended)
    https://itch.io/embed-upload/7278415?color=333333

    On top left enter one of these to get some artworks from our US artists

    ccn/dara/demon3
    ccn/dara/skulltree2 (what I attached)
    ccn/dara/firebird2

    The artworks' textures and meshes are streamed from our cloud servers to the WebGL build, thus the load might take a few seconds. Use the little "cloud" looking leftmost icon at bottom to return to the search scene to load another.

    Use W or D to rotate the camera to see if load completed since I removed the UI needed for that purpose.

    I want to take a moment to thank you again, you were of great assistance and ironed out all the issues in most proficient manner.

    Dara




    Screen Shot 2023-02-05 at 12.24.59 AM.png
     
  29. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    I'm glad you found the issue!

    On a small update for the project:
    I added another improvement for the develop WebGL template: there is now a counter for log messages types that also allows you to filter similar to what you are used to in the unity console:
    upload_2023-2-7_7-27-7.png
    You can have a look here: https://deml.io/experiments/unity-webgl/2022.2.5f1-urp-webgl2
     
    darashayda likes this.
  30. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Johannski please tell me how you set this up? If you like I could setup my builds with your experiments and compare notes with the Unity community.

    D
     
  31. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    You can set it up, by using the develop template from the github project: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/master/Assets/WebGLTemplates/Develop /this needs to be put into Assets/WebGLTemplates)
    Then you can just select it in the project settings under Resolution and Presentation. And that's it, then it should work out of the box. If you want to use the commands logic as well, you would need to copy the WebGLTools folder from the plugins as well: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/master/Assets/Plugins/WebGL/WebGLTools (also into the Plugins/WebGL folder).

    The easy html console access is especially useful on mobile devices, since it is a bit annoying to get those information (e.g. you need a Mac to get your iOS console logs). With the console you can easily copy one or all console messages into your clipboard to do whatever you want to do with them.
     
    Thaina likes this.
  32. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    I added quite a few new nice features and decided it is time for a new version, you can find all changes in the release notes: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases/tag/1.1.0

    DebugConsole.png
    The console got quite a few quality of life improvements and I added some new commands to test different stuff. All unity builds with their latest patch version are updated with this new feature set and the build sizes were updated. Quite interesting to see, that 2022.2.x grew quite a bit compared to 2021.3.

    Have fun testing :)
     
  33. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    Johannski likes this.
  34. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Cheers, glad you appreciate it, and I'm happy to see your use case, looks like an interesting project to make technology more accessible!
     
  35. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    @dnach The regression bug for WebGL1 with URP seems to have reappeared somewhere between 2022.2.9f1 (working) and 2022.2.12f1 (not working anymore).
    See builds:
    Code (CSharp):
    1. [08:13:35] Applying workaround to Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=1397977
    2. [08:13:35] [UnityCache] 'https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/bb089cb867b2764d399526f64e4c713c.data.br' successfully revalidated and served from the indexedDB cache
    3. [08:13:35] navigator.mediaDevices support available
    4. [08:13:36] [UnityMemory] Configuration Parameters - Can be set up in boot.config
    5. [08:13:36] "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    6. [08:13:36] "memorysetup-temp-allocator-size-audio-worker=65536"
    7. [08:13:36] "memorysetup-temp-allocator-size-background-worker=32768"
    8. [08:13:36] "memorysetup-bucket-allocator-granularity=16"
    9. [08:13:36] "memorysetup-bucket-allocator-bucket-count=8"
    10. [08:13:36] "memorysetup-bucket-allocator-block-size=4194304"
    11. [08:13:36] "memorysetup-bucket-allocator-block-count=1"
    12. [08:13:36] "memorysetup-main-allocator-block-size=16777216"
    13. [08:13:36] "memorysetup-thread-allocator-block-size=16777216"
    14. [08:13:36] "memorysetup-gfx-main-allocator-block-size=16777216"
    15. [08:13:36] "memorysetup-gfx-thread-allocator-block-size=16777216"
    16. [08:13:36] "memorysetup-cache-allocator-block-size=4194304"
    17. [08:13:36] "memorysetup-typetree-allocator-block-size=2097152"
    18. [08:13:36] "memorysetup-profiler-bucket-allocator-granularity=16"
    19. [08:13:36] "memorysetup-profiler-bucket-allocator-bucket-count=8"
    20. [08:13:36] "memorysetup-profiler-bucket-allocator-block-size=4194304"
    21. [08:13:36] "memorysetup-profiler-bucket-allocator-block-count=1"
    22. [08:13:36] "memorysetup-profiler-allocator-block-size=16777216"
    23. [08:13:36] "memorysetup-profiler-editor-allocator-block-size=1048576"
    24. [08:13:36] "memorysetup-temp-allocator-size-main=4194304"
    25. [08:13:36] "memorysetup-job-temp-allocator-block-size=2097152"
    26. [08:13:36] "memorysetup-job-temp-allocator-block-size-background=1048576"
    27. [08:13:36] "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    28. [08:13:36] Loading player data from data.unity3d
    29. [08:13:36] Initialize engine version: 2022.2.14f1 (b2c9b1ac6cc0)
    30. [08:13:36] [Subsystems] Discovering subsystems at path UnitySubsystems
    31. [08:13:36] Creating WebGL 1.0 context.
    32. [08:13:36] Renderer: ANGLE (Intel, Intel(R) HD Graphics 400 Direct3D11 vs_5_0 ps_5_0)
    33. [08:13:36] Vendor: Mozilla
    34. [08:13:36] Version: OpenGL ES 2.0 (WebGL 1.0)
    35. [08:13:36] GLES: 2
    36. [08:13:36] ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_half_float EXT_float_blend EXT_frag_depth EXT_shader_texture_lod EXT_sRGB EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context GL_ANGLE_instanced_arrays GL_EXT_blend_minmax GL_EXT_color_buffer_half_float GL_EXT_float_blend GL_EXT_frag_depth GL_EXT_shader_texture_lod GL_EXT_sRGB GL_EXT_texture_compression_bptc GL_EXT_texture_compression_rgtc GL_EXT_texture_filter_anisotropic GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture
    37. [08:13:36] _half_float_linear GL_OES_vertex_array_object GL_WEBGL_color_buffer_float GL_WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc_srgb GL_WEBGL_debug_renderer_info GL_WEBGL_debug_shaders GL_WEBGL_depth_texture GL_WEBGL_draw_buffers GL_WEBGL_lose_context
    38. [08:13:36] OPENGL LOG: Creating OpenGL ES 2.0 graphics device ; Context level ; Context handle 1
    39. [08:13:36] WARNING: RGBA Compressed ASTC6X6 UNorm format is not supported, decompressing texture
    40. [08:13:37] ERROR: Shader
    41. [08:13:37] Hidden/Universal Render Pipeline/Blit shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    42. [08:13:37] ERROR: Shader
    43. [08:13:37] Hidden/Universal Render Pipeline/CopyDepth shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    44. [08:13:37] ERROR: Shader
    45. [08:13:37] Hidden/Universal Render Pipeline/ScreenSpaceShadows shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    46. [08:13:37] ERROR: Shader
    47. [08:13:37] Hidden/Universal Render Pipeline/Sampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    48. [08:13:37] ERROR: Shader
    49. [08:13:37] Hidden/Universal Render Pipeline/LutBuilderLdr shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    50. [08:13:37] ERROR: Shader
    51. [08:13:37] Hidden/Universal Render Pipeline/LutBuilderHdr shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    52. [08:13:37] ERROR: Shader
    53. [08:13:37] Hidden/Universal Render Pipeline/UberPost shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    54. [08:13:37] ERROR: Shader
    55. [08:13:37] Hidden/Universal Render Pipeline/CameraMotionVectors shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    56. [08:13:37] ERROR: Shader
    57. [08:13:37] Hidden/Universal Render Pipeline/ObjectMotionVectors shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    58. [08:13:37] ERROR: Shader
    59. [08:13:37] Hidden/Universal Render Pipeline/Stop NaN shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    60. [08:13:37] ERROR: Shader
    61. [08:13:37] Hidden/Universal Render Pipeline/SubpixelMorphologicalAntialiasing shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    62. [08:13:37] ERROR: Shader
    63. [08:13:37] Hidden/Universal Render Pipeline/GaussianDepthOfField shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    64. [08:13:37] ERROR: Shader
    65. [08:13:37] Hidden/Universal Render Pipeline/BokehDepthOfField shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    66. [08:13:37] ERROR: Shader
    67. [08:13:37] Hidden/Universal Render Pipeline/CameraMotionBlur shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    68. [08:13:37] ERROR: Shader
    69. [08:13:37] Hidden/Universal Render Pipeline/PaniniProjection shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    70. [08:13:37] ERROR: Shader
    71. [08:13:37] Hidden/Universal Render Pipeline/Bloom shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    72. [08:13:37] ERROR: Shader
    73. [08:13:37] Hidden/Universal Render Pipeline/TemporalAA shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    74. [08:13:37] ERROR: Shader
    75. [08:13:37] Hidden/Universal Render Pipeline/LensFlareDataDriven shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    76. [08:13:37] ERROR: Shader
    77. [08:13:37] Hidden/Universal Render Pipeline/Scaling Setup shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    78. [08:13:37] ERROR: Shader
    79. [08:13:37] Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    80. [08:13:37] ERROR: Shader
    81. [08:13:37] Hidden/Universal Render Pipeline/FinalPost shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    82. [08:13:37] Input Manager initialize...
    83. [08:13:37] UnloadTime: 1.000000 ms
    84. [08:13:37] WebGlPlugins.SetVariable set webGlVersion: WebGL 1
    85. [08:13:37] WebGlPlugins.SetVariable set unityVersion: 2022.2.14f1
    86. [08:13:37] WebGlPlugins.SetVariable set unityCaptureAllKeyboardInputDefault: true
    87. [08:13:37] Time tracker event Awake: 2442.00ms
    88. [08:13:39] Unity WebGL Bridge ready -> Run 'unityGame.SendMessage("WebGL", "Help")' in the browser console to see usage
    89. [08:13:39] Time tracker event Start: 4470.00ms
    90. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    91. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    92. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    93. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    94. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    95. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    96. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    97. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    98. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    99. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    100. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    101. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    102. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    103. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    104. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    105. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    106. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    107. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    108. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    109. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    110. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    111. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    112. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    113. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    114. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    115. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    116. [08:13:39] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    117. [08:13:39] NullReferenceException: Object reference not set to an instance of an object.
    118. [08:13:39] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    119. [08:13:40] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    120. [08:13:40] Texture creation failed. 'R32_SFloat' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    121. [08:13:40] NullReferenceException: Object reference not set to an instance of an object.
    122. [08:13:40] 'ShadowAuto' is not supported. RenderTexture::GetTemporary fallbacks to DepthAuto format on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    123. [08:13:47] Invoking error handler due to
    124. RuntimeError: indirect call signature mismatch
    125. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[8508]:0x420085
    126. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[26544]:0xda154d
    127. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[1917]:0xc75cc
    128. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[50331]:0x1297a8e
    129. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[23604]:0xd20e1b
    130. invoke_iiii@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:352780
    131. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[19627]:0xb179ba
    132. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[50924]:0x12ddfa1
    133. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[445]:0x49fa4
    134. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[51906]:0x13282fe
    135. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[34679]:0xefcc89
    136. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[34112]:0xef07e8
    137. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[756]:0x5ef17
    138. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[6459]:0x2fb851
    139. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[5095]:0x248ca6
    140. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[9385]:0x49ef0d
    141. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[3223]:0x14cb02
    142. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[5356]:0x2675e0
    143. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[10282]:0x51bf37
    144. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[17901]:0x9d2338
    145. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[17818]:0x9b5219
    146. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[44868]:0x1122dfe
    147. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[10191]:0x504415
    148. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[44638]:0x1105dc0
    149. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[23603]:0xd20e0d
    150. invoke_iii@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:351319
    151. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[15180]:0x823115
    152. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[9143]:0x47f395
    153. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[35240]:0xf1467e
    154. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[4904]:0x22d7cf
    155. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[50331]:0x12979aa
    156. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[23604]:0xd20e1b
    157. invoke_iiii@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:352780
    158. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[19627]:0xb179ba
    159. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[5633]:0x28dbee
    160. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[689]:0x5b69b
    161. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[10688]:0x569f92
    162. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[53754]:0x134b511
    163. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[20052]:0xb53fd3
    164. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[20052]:0xb54042
    165. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[11228]:0x5b9fb6
    166. @https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/b68c1b607a14869cd6828ab0d81b8f28.wasm.br:wasm-function[23598]:0xd20dcf
    167. browserIterationFunc@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:204031
    168. callUserCallback@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:157600
    169. runIter@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:158856
    170. Browser_mainLoop_runner@https://deml.io/experiments/unity-webgl/2022.2.14f1-urp-webgl1/Build/5ad51b26e5e36d2a5177402d46b31334.js.br:10:157136

    Also another question on WebGL 2 with builtin render pipeline: This does not run for me on iOS for a long time now (Unity logo is rendered and start and awake calls are received, but nothing is rendered). Is this something you are working on as well? You can easily reproduce this by testing any of the builtin render pipeline WebGL2 builds with Unity 2021.3+. All builds, e.g. 2022.2.14f1-webgl2
     
  36. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Some updates from my side:

    I added proper support for all of Unity's rich text tags (<color><size><b><i>) with support for nesting.


    Additionally I also revamped the Template a bit to have a logo in the beginning and options to define min and max aspect ratios for the view - UI designers will be very happy about not caring for some absurd aspect ratios I guess :)


    Another positive note: WebGL 2 with builtin render pipeline now works for me on iOS - This seems to be fixed with iOS 16.4.1, since now also builds work, that prior didn't work.

    WebGL 1 URP is still broken on iOS with Unity 2022.2.17f1, so the note from the last post still stands. The problem does not exist with 2021.3.x, so stay on the LTS version if you need that specific support.
     
  37. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,970
    Great effort! :)

    I wanted to do a quick test of my own because I was sure this wasn't the end of the road in terms of build size optimizations.

    I chose Unity 2021.3.25f1 for testing and the "3D (URP)" project template, added a Cube to the SampleScene, removed WebGL v1 and set ColorSpace to Linear.

    That's what resulted in the first URP WebGL v2 build with 7.08 MB:
    upload_2023-5-18_11-11-48.png

    Next, I built/optimized for size, high stripping level, disable exceptions, Master compiler config, Optimize Mesh Data and possibly a few more. Those were the next two "OptimizeForSize" builds.

    Then I went into Package Manager and removed all of the Packages except for URP. That's the 5.74 MB build.

    Lastly, I disabled all the built-in modules. Actually, I simply changed manifest.json to just this so I wouldn't have to go through the UI and wait for a recompile after disabling each module:
    Code (CSharp):
    1. {
    2.   "dependencies": {
    3.     "com.unity.render-pipelines.universal": "12.1.11"
    4.   }
    5. }
    The end result is a URP WebGL v2 build with 4.86 MB size.

    Sure it is unrealistic to some degree (eg no Audio) but I wanted to prove a point: if you are very hard pressed to optimize a WebGL build size, it DOES help to remove excess packages (eg Visual Scripting, Timeline) and more so disabling all of the built-in modules that you don't rely on. Specifically those that many Web games can do without, like: AI, Cloth, NVIDIA, Umbra, Physics 2D, Terrain, Vehicles, VR, Wind, XR ...

    I didn't check but I bet this will also speed up build times.

    Oh, and I made one last test:
    upload_2023-5-18_11-31-28.png

    And this is when I realized I so far hadn't used the "Minimal" WebGL template for the URP builds, that's another 0.03 MB gone:
    upload_2023-5-18_11-43-27.png

    For comparison: the WebGL build sizes page lists 6.25 MB for a URP WebGL v2 build for this Unity version!

    I shaved off this much by aggressively using these Asset Import Override settings:
    upload_2023-5-18_11-32-45.png

    I understand that specifically max texture sizes of 64x64 is not going to be welcome in most games, but nevertheless it could suffice for an old-school pixel art game but I cannot begin to judge what terribly dismembering deeds the compression might do to those remaining pixels. ;)

    Finally, I took all of these settings and re-applied them to a Legacy Render Pipeline project, which resulted in this build size:
    upload_2023-5-18_11-40-58.png

    That's nearly 1 MB less than the 2.76 MB size given on the list of build sizes.

    Point proven: you CAN strip down the WebGL build sizes even further by a significant margin IF you are tweaking aggressively and/or are willing to try out "lossy" settings. Especially disabling unused modules and - to a much lesser degree - packages can help shave off a few MB from the build (this goes for all platforms).

    Note 1: I used the defaults for Texture Compression (DXT) and Compression Format (Brötli).
    Note 2: I think I read somewhere (possibly this thread?) that the splash screen images in Unity's personal edition add a significant overhead, in particular for URP. So you may be able to get even smaller builds with Splash Screen disabled when using the Pro license. Would be interesting to see how much removing the default splash screen affects the build size.
     
    Last edited: May 24, 2023
    mgear, wansy, Johannski and 3 others like this.
  38. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,970
    Also worth knowing for those curious where these size differences between URP and legacy are coming from ... here's the two build reports:
    Code (CSharp):
    1. URP Build Report
    2. Uncompressed usage by category (Percentages based on user generated assets only):
    3. Textures               65.3 kb     8.5%
    4. Meshes                 0.0 kb     0.0%
    5. Animations             0.0 kb     0.0%
    6. Sounds                 0.0 kb     0.0%
    7. Shaders                373.6 kb     48.6%
    8. Other Assets           212.9 kb     27.7%
    9. Levels                 0.0 kb     0.0%
    10. Scripts                61.7 kb     8.0%
    11. Included DLLs          0.0 kb     0.0%
    12. File headers           55.1 kb     7.2%
    13. Total User Assets      768.6 kb     100.0%
    14. Complete build size    3.5 mb
    15.  
    16. Legacy Build Report
    17. Uncompressed usage by category (Percentages based on user generated assets only):
    18. Textures               0.0 kb     0.0%
    19. Meshes                 0.0 kb     0.0%
    20. Animations             0.0 kb     0.0%
    21. Sounds                 0.0 kb     0.0%
    22. Shaders                62.9 kb     86.4%
    23. Other Assets           1.9 kb     2.6%
    24. Levels                 0.0 kb     0.0%
    25. Scripts                0.0 kb     0.0%
    26. Included DLLs          0.0 kb     0.0%
    27. File headers           8.0 kb     11.0%
    28. Total User Assets      72.7 kb     100.0%
    29. Complete build size    1.8 mb
    30.  
    Given the size of URP shaders I was hoping that disabling post-processing and other camera effects / graphics settings might have an effect on the build size .. but it didn't. Except for the skybox that was mentioned, thus the final URP build size is 3.47 MB w/o skybox. I haven't found any more tweakable settings that positively affect the size.
     
    Last edited: May 18, 2023
  39. AdamandEveStudios

    AdamandEveStudios

    Joined:
    Apr 19, 2022
    Posts:
    20
    Absolutely superb testing. Incredibly helpful. Really boggles my mind why any of these unity packages are included by default. One of the biggest size offenders I had was Newtonsoft (had to use it for multiple reasons) which referenced ~3MB of DLLS and other packages.

    I also had to remove cinemachine and post processing as they referenced numerous other packages that dirtied up the build size. Post processing is absolutely abysmal for build size. Bloats it with thousands of scripts and many MBs of incompressible textures. Have you found a workaround to post processing? For arguments sake lets say the only effects being used are Color correcting, chromatic ab, and lens distortion. Can all the other unused effects be stripped? I have only found one PP stripper on github but it only works at build time whereas I would like to permanently remove the unused PP assets from project. PP also references a few other DLLs / packages further bloating the size. Perhaps best option is to just entirely recreate these simple PP effects. Thats what I ended up doing with cinemachine although that is evidently significanly easier than recreating PP haha.

    This all leaves me wondering if it would be possible to have these packages download after the user is loaded on the initial 3MB site. Instant page load is truly a beautiful feeling and that extra 10MB will turn away players with slow internet. Do you know if this is possible?
     
    GDevTeam likes this.
  40. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Nice, thanks for the deep dive! I also thought about disabling some of the built-in assets, but decided to have a rather minimal optimization there, since some games will rely on some of the stuff, so I went with only the script optimizations and try to keep everything else rather vanilla. Still nice o see, what can be done with some effort on that side!
     
  41. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    I had some time to get an 2022.3 build out. It took me a bit longer, since builds failed and I didn't know why. I had the time today to look into it, and apparently Unity broke the NameFilesAsHashes setting (see also https://forum.unity.com/threads/unity-2022-3-name-files-as-hashes-broken.1446940/).
    With disabling that feature I could now build again with Unity 2022.3.1f1.

    There are no real differences to 2022.2 from what I can tell right now. Compared to 2022.2 builds, the build size increased by ~20KB. As always you can test the new builds here: https://deml.io/experiments/unity-webgl/
     
    ProGameDevUser likes this.
  42. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Hi! Thank you so much for such a contribution to the knowledge of this topic! Can you please tell me how to reduce the loading time of the WebGL application on the phone? I put together a completely empty project on unity and it loads in an average of 10-12 seconds, which is a lot, tested on different mobile devices in 2016-2019
     
  43. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Hey! 10-12 seconds sounds not that good, but I also don't know which specific hardware you are using. My first suggestion would be, to check the loading times from my builds over here: https://deml.io/experiments/unity-webgl/
    If you see, that those load a lot faster (which I hope they do), then probably it is something about your settings. You can see all settings I used in the github repo and use that as a basis. In general, development builds will take a lot longer to load, so don't try to evaluate loading times with those (since those are also not the builds you want to ship), and in my experience builtin render pipeline is faster to load than URP.
     
    ProGameDevUser likes this.
  44. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Yes, indeed! I load your builds an order of magnitude faster, and the best result was about 7 seconds, super! However, I read in your repository manual that your server is properly configured to transfer and compress brat li streams, please tell me if it is possible to do this if I bought a regular hosting and do not have access to the server settings?
     
  45. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    This setup runs on Greengeeks with a normal webhosting plan, no own server in this case. It depends on the web server technology they are offering. Normally this is something like Apache or nginx. For Apache you will either need to have the module already enabled or you get a webinterface from your hosting company in which you can enable the brotli module.
    If brotli is not an option, gzip is also very decent and is a lot more common, so you should be able to get at least that from any web hosting provider.
    Then the next step is to set up the correct htaccess file. You can find more about that in the readme of the project or from Unity's documentation.
     
    ProGameDevUser likes this.
  46. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Thank you very much! Your hosting is good, since it allows you to do such manipulations, I was told that you can't make such edits, only on a dedicated server :D
     
  47. Agha

    Agha

    Joined:
    Aug 15, 2014
    Posts:
    1
    @Johannski :
    I am in debt for your amazing contribution to this framework!!:)
    I tested this in 2022.3.4f1, and it worked amazing,
    Just a small bug observed the logo is not loading properly at the loading scene It shows like below Screenshot, can you please help me to solve this, I know I am a rookie in this field but love your work.
     

    Attached Files:

  48. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Heya! Glad you find it helpful.
    As for the logo: There is a file called logo.svg in the template folder (Release template folder, Develop template folder).
    My first two ideas would be: You deleted the icon or replaced it with a file that was not an svg or your server does not support svg files. If you want this logo in a different format or want to link to something else, you can always replace it in the template index file - You will find it here: https://github.com/JohannesDeml/Uni...Assets/WebGLTemplates/Release/index.html#L123

    I chose svg, because it is vector-based (so no pixelation when scaled up) and also small in general. But of course if your logo does not exist in a vector format it makes sense to change this to a png or similar file format :)
     
    Agha likes this.
  49. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    HipJiveGuy, yaezah and ProGameDevUser like this.
  50. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    Thank you and will be looking into your good work shortly