Skip to content

Commit b993b9d

Browse files
committed
Add some more documentation to the readme
1 parent dfbb041 commit b993b9d

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed
65.9 KB
Loading

Documentation/DebugConsole.png

100 KB
Loading
48.5 KB
Loading

README.md

+35-27
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![](https://img.shields.io/github/release-date/JohannesDeml/UnityWebGL-LoadingTest.svg)](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases) [![Tested up to Unity 2022.2](https://img.shields.io/badge/tested%20up%20to%20unity-2022.2-green.svg?logo=unity&cacheSeconds=2592000)](https://unity3d.com/get-unity/download/archive)
66

7-
*Testing Unity's WebGL size and loading time for different versions and platforms*
7+
*Testing Unity's WebGL size and loading time for different versions (2018.4 - 2022.2) and platforms*
88

99
* [Unity Forum Thread](https://forum.unity.com/threads/webgl-builds-for-mobile.545877/)
1010
* [Overview page of all builds](https://deml.io/experiments/unity-webgl/)
@@ -16,7 +16,8 @@
1616
* GPU Instancing for materials
1717
* Shadows
1818
* Brotli Compression
19-
* Togglable In-DOM Debug console ([Demo](https://deml.io/experiments/unity-webgl/2021.1.4f1/))
19+
* Togglable In-DOM Debug console
20+
![Debug Console Screenshot with description of features](./Documentation/DebugConsole.png)
2021
* Easy access to unity functions through the browser console ([Demo](https://deml.io/experiments/unity-webgl/2020.3.23f1/)|[Youtube](https://youtu.be/OjypxsD6XMI))
2122
* Handy debug functions for times and memory consumption
2223
* Responsive template layout for maximum mobile compatibility
@@ -34,7 +35,7 @@ Version | Size | Link
3435
2021.3.16f1 | 2.74 MB | https://deml.io/experiments/unity-webgl/2021.3.16f1-webgl2
3536
2021.2.19f1 | 2.58 MB | https://deml.io/experiments/unity-webgl/2021.2.19f1-webgl2
3637
2021.1.28f1 | 2.94 MB | https://deml.io/experiments/unity-webgl/2021.1.28f1-webgl2
37-
2020.3.43f1 | 2.93 MB | https://deml.io/experiments/unity-webgl/2020.3.43f1-webgl2
38+
2020.3.44f1 | 2.93 MB | https://deml.io/experiments/unity-webgl/2020.3.44f1-webgl2
3839
2019.4.40f1 | 3.04 MB | https://deml.io/experiments/unity-webgl/2019.4.40f1-webgl2
3940
2018.4.36f1 | 2.83 MB | https://deml.io/experiments/unity-webgl/2018.4.36f1-webgl2
4041

@@ -46,7 +47,7 @@ Version | Size | Link
4647
2021.3.16f1 | 2.72 MB | https://deml.io/experiments/unity-webgl/2021.3.16f1-webgl1
4748
2021.2.19f1 | 2.56 MB | https://deml.io/experiments/unity-webgl/2021.2.19f1-webgl1
4849
2021.1.28f1 | 2.92 MB | https://deml.io/experiments/unity-webgl/2021.1.28f1-webgl1
49-
2020.3.43f1 | 2.92 MB | https://deml.io/experiments/unity-webgl/2020.3.43f1-webgl1
50+
2020.3.44f1 | 2.92 MB | https://deml.io/experiments/unity-webgl/2020.3.44f1-webgl1
5051
2019.4.40f1 | 3.01 MB | https://deml.io/experiments/unity-webgl/2019.4.40f1-webgl1
5152
2018.4.36f1 | 2.82 MB | https://deml.io/experiments/unity-webgl/2018.4.36f1-webgl1
5253

@@ -56,8 +57,9 @@ Version | Size | Link
5657
2022.2.2f1 | 2.69 MB | https://deml.io/experiments/unity-webgl/2022.2.2f1-minsize-webgl1
5758
2022.1.24f1 | 2.64 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-minsize-webgl1
5859
2021.3.16f1 | 2.58 MB | https://deml.io/experiments/unity-webgl/2021.3.16f1-minsize-webgl1
60+
2021.2.19f1 | 2.42 MB | https://deml.io/experiments/unity-webgl/2021.2.19f1-minsize-webgl1
5961
2021.1.28f1 | 2.48 MB | https://deml.io/experiments/unity-webgl/2021.1.28f1-minsize-webgl1
60-
2020.3.43f1 | 2.48 MB | https://deml.io/experiments/unity-webgl/2020.3.43f1-minsize-webgl1
62+
2020.3.44f1 | 2.48 MB | https://deml.io/experiments/unity-webgl/2020.3.44f1-minsize-webgl1
6163
2019.4.40f1 | 2.98 MB | https://deml.io/experiments/unity-webgl/2019.4.40f1-minsize-webgl1
6264
2018.4.36f1 | 2.79 MB | https://deml.io/experiments/unity-webgl/2018.4.36f1-minsize-webgl1
6365

@@ -67,7 +69,9 @@ Version | Size | Link
6769
2022.2.2f1 | 6.86 MB | https://deml.io/experiments/unity-webgl/2022.2.2f1-urp-webgl2
6870
2022.1.24f1 | 6.44 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl2
6971
2021.3.16f1 | 6.25 MB | https://deml.io/experiments/unity-webgl/2021.3.16f1-urp-webgl2
70-
2020.3.43f1 | 5.57 MB | https://deml.io/experiments/unity-webgl/2020.3.43f1-urp-webgl2
72+
2021.2.19f1 | 6.18 MB | https://deml.io/experiments/unity-webgl/2021.2.19f1-urp-webgl2
73+
2021.1.28f1 | 5.80 MB | https://deml.io/experiments/unity-webgl/2021.1.28f1-urp-webgl2
74+
2020.3.44f1 | 5.57 MB | https://deml.io/experiments/unity-webgl/2020.3.44f1-urp-webgl2
7175
2019.4.40f1 | 5.55 MB | https://deml.io/experiments/unity-webgl/2019.4.40f1-urp-webgl2
7276
2018.4.36f1 | 2.80 MB | https://deml.io/experiments/unity-webgl/2018.4.36f1-urp-webgl2
7377

@@ -77,10 +81,13 @@ Version | Size | Link
7781
2022.2.2f1 | 6.74 MB | https://deml.io/experiments/unity-webgl/2022.2.2f1-urp-webgl1
7882
2022.1.24f1 | 6.31 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl1
7983
2021.3.16f1 | 6.07 MB | https://deml.io/experiments/unity-webgl/2021.3.16f1-urp-webgl1
80-
2020.3.43f1 | 5.41 MB | https://deml.io/experiments/unity-webgl/2020.3.43f1-urp-webgl1
84+
2021.2.19f1 | 5.99 MB | https://deml.io/experiments/unity-webgl/2021.2.19f1-urp-webgl1
85+
2021.1.28f1 | 5.57 MB | https://deml.io/experiments/unity-webgl/2021.1.28f1-urp-webgl1
86+
2020.3.44f1 | 5.41 MB | https://deml.io/experiments/unity-webgl/2020.3.44f1-urp-webgl1
8187
2019.4.40f1 | 5.50 MB | https://deml.io/experiments/unity-webgl/2019.4.40f1-urp-webgl1
8288
2018.4.36f1 | 2.80 MB | https://deml.io/experiments/unity-webgl/2018.4.36f1-urp-webgl1
8389

90+
8491
## Platform Compatibility
8592

8693
| Platform | Chrome | Firefox | Edge | Safari | Internet Explorer |
@@ -89,32 +96,36 @@ Version | Size | Link
8996
| Linux | ✔️ | ✔️ | ✔️ |||
9097
| Mac | ✔️ | ✔️ | ✔️ | ✔️ ||
9198
| Android | ✔️ | ✔️ | ✔️ |||
92-
| iOS | ✔️ | | ✔️ | ✔️ ||
99+
| iOS | ✔️ | | ✔️ | ✔️ ||
93100

94101
✔️ *: Supported* | ⚠️ *: Warning , see below* | ❌ *: not supported* | ➖ *: Not applicable*
95102

96-
* For Unity 2019 builds throw an error on **iOS Firefox** (Does not happen for iOS Safari or iOS Chrome): `An error occured running the Unity content on this page. See you browser JavaScript console for more info. The error: Script error.`
103+
* For older Unity 2019 builds throw an error on **iOS Firefox** (Does not happen for iOS Safari or iOS Chrome): `An error occured running the Unity content on this page. See you browser JavaScript console for more info. The error: Script error.` - with iOS 16.2 and Firefox 108 I could not reproduce this problem anymore on 2019.4.
97104
* Internet Explorer does not work for Unity WebGL builds, since it does not support wasm.
98105
* Previous versions of Firefox on Android had some performance problems, they seemed to have fixed those. In general performance on mobile is by far not as good as a native app build, but should be enough for simple games.
99106

100107
## Notes
101108

109+
* There are some combinations for **iOS** that have **problems**: With recent versions **URP with WebGL 1** does not work at all and **builtin renderpipeline with WebGL 2** has performance problems or might not load at all. I recommend to either use URP with WebGL2 or builtin with WebGL1, if you are targeting iOS. You can always test the builds on your device, to see which combination might fit your needs: https://deml.io/experiments/unity-webgl/
102110
* If you want to use this project as a basis for your project, be sure to select the release/branch for your unity version. Beta versions oftentimes have problems, therefore I would recommend to use the latest LTS version to run your project.
103111
* The server is configured to support wasm streaming and brotli compression, see [.htaccess 2020](./Configuration/2020/.htaccess) [.htaccess 2019](./Configuration/2019/.htaccess)
112+
* Some servers (such as itch.io) don't support brotli compression, you should then use gzip compression instead. If brotli is missconfigured or not supported you will get an error along the lines of:
113+
```
114+
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.
115+
```
116+
You can change the compression in the project settings:
117+
![Screenshot of project settings gzip dropdown](./Documentation/ChangeCompressionToGzip.png)
104118
* In order to get rid of the warning on android/iOS it is removed in a post process build step ([File](./Assets/Scripts/Editor/RemoveMobileSupportWarningWebBuild.cs))
105119
* You might need to reload the page on android/iOS when running the first time
106120
* This is a very small example. When building larger WebGL applications, you might run into problems with memory or compile errors. I recommend to build from the start and very often, to catch the changes that create those problems.
107-
* If you want to have the smallest file size possible, take a look at [Project Tiny](https://forum.unity.com/forums/project-tiny.151/) or web-specific libraries like [Three.js](https://threejs.org/).
121+
* If you want to have the smallest file size possible and faster load times, take a look at [Project Tiny](https://forum.unity.com/forums/project-tiny.151/) or web-specific libraries like [Three.js](https://threejs.org/) or [PlayCanvas](https://playcanvas.com/).
108122
* Removing the default skybox will save ~30kb.
109123
* With 2021.2 Unity added the possibility to use different texture formats. The builds use the default DXT format, but since no texture is used this settings does not make any difference in this project.
110124

111125
### URP
112126
* URP adds additional ~2.5 MB file size compared to the builtin render pipeline.
113-
114127
* In general the performance for URP seems to be better compared to builtin, but it has a larger build size.
115-
116128
* With Unity 2021.2 there is currently a problem with shader compilation and therefore builds fail:
117-
118129
```
119130
Shader error in 'Hidden/Universal/CoreBlit': invalid subscript 'positionCS' at
120131
UnityWebGL-LoadingTest/Library/PackageCache/[email protected]/Runtime/Utilities/Blit.hlsl(92) (on gles)
@@ -129,18 +140,13 @@ Version | Size | Link
129140
Platform defines: SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_ENABLE_DETAIL_NORMALMAP UNITY_LIGHTMAP_RGBM_ENCODING UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
130141
Disabled keywords: SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING
131142
```
132-
133143
* URP on mobile runs a lot better with WebGL 2 than WebGL 1 on iOS. For example compare [2021.3.6f1 URP WebGL1](https://deml.io/experiments/unity-webgl/2021.3.6f1-urp) with [2021.3.6f1 URP WebGL2](https://deml.io/experiments/unity-webgl/2021.3.6f1-urp-webgl2) on your iPhone.
134-
135144
* Unity 2022.1 has problems building for URP with WebGL1 (also on desktop), error:
136-
137145
```
138146
Texture creation failed. 'ShadowAuto' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
139147
140148
NullReferenceException: Object reference not set to an instance of an object.
141149
```
142-
143-
144150

145151
### Min Size builds
146152
* Built with `Tools/Build WebGL/minsize`
@@ -172,7 +178,10 @@ unityGame.SendMessage("WebGL", "Help"); -> Log all available commands
172178

173179
## Github Build Actions
174180

175-
This repository supports continuous Integration through [game.ci](https://game.ci/). The main github actions workflow is [release.yml](./.github/workflows/release.yml). On Unity side a custom build script on the basis of [game.ci's BuildScript](https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs) is used: [BuildScript.cs](./Assets/Scripts/Editor/BuildScript.cs). This script supports defining different build logic through git tags through the following syntax: `UNITY_VERSION`-`TAG1`-`TAG2`... Example: `2022.2.0f1-urp-webgl2`
181+
This repository supports continuous Integration through [game.ci](https://game.ci/). There are scripts for creating a unity license, building the project and upgrading the project.
182+
183+
### Automatic builds
184+
The main github actions workflow is [release.yml](./.github/workflows/release.yml). On Unity side a custom build script on the basis of [game.ci's BuildScript](https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs) is used: [BuildScript.cs](./Assets/Scripts/Editor/BuildScript.cs). This script supports defining different build logic through git tags through the following syntax: `UNITY_VERSION`-`TAG1`-`TAG2`... Example: `2022.2.0f1-urp-webgl2`
176185

177186
The following tags are supported:
178187

@@ -181,16 +190,15 @@ The following tags are supported:
181190
* `webgl1`: Build for WebGL1
182191
* `webgl2`: Build for WebGL2
183192

184-
## Older versions
193+
### Upgrade Unity CI
194+
195+
For upgrading Unity [upgrade-unity.yml](./.github/workflows/upgrade-unity.yml) is used. It can be triggered through github actions manually by defining the branch to upgrade and some additional settings
196+
![Upgrade Unity Github Action screenshot](./Documentation/UpgradeUnityGithubAction.png)
197+
It will create a pull request with the newly defined unity version along with tags to trigger automatic builds. Additionally, all packages are updated to their latest version, see also [UnityPackageScripts.cs](./Assets/Scripts/Editor/UnityPackageScripts.cs).
185198

186-
| Version | Size | Link |
187-
| ---------- | ------- | --------------------------------------------------- |
188-
| 2018.2.3f1 | 2.97 MB | https://deml.io/experiments/unity-webgl/2018.2.3f1/ |
189-
| 2019.3.0f6 | 3.28 MB | https://deml.io/experiments/unity-webgl/2019.3.0f6/ |
190-
| 2020.1.0f1 | 2.86 MB | https://deml.io/experiments/unity-webgl/2020.1.0f1/ |
191-
| 2020.2.0f1 | 2.82 MB | https://deml.io/experiments/unity-webgl/2022.2.0f1/ |
199+
## Older versions
192200

193-
You can find a list of all builds over here: https://deml.io/experiments/unity-webgl/
201+
You can find a list of all live builds with their sizes over here: https://deml.io/experiments/unity-webgl/
194202

195203
## License
196204

0 commit comments

Comments
 (0)