You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-27
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
[](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases)[](https://unity3d.com/get-unity/download/archive)
6
6
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*
8
8
9
9
*[Unity Forum Thread](https://forum.unity.com/threads/webgl-builds-for-mobile.545877/)
10
10
*[Overview page of all builds](https://deml.io/experiments/unity-webgl/)

20
21
* Easy access to unity functions through the browser console ([Demo](https://deml.io/experiments/unity-webgl/2020.3.23f1/)|[Youtube](https://youtu.be/OjypxsD6XMI))
21
22
* Handy debug functions for times and memory consumption
22
23
* Responsive template layout for maximum mobile compatibility
| Platform | Chrome | Firefox | Edge | Safari | Internet Explorer |
@@ -89,32 +96,36 @@ Version | Size | Link
89
96
| Linux | ✔️ | ✔️ | ✔️ | ➖ | ➖ |
90
97
| Mac | ✔️ | ✔️ | ✔️ | ✔️ | ➖ |
91
98
| Android | ✔️ | ✔️ | ✔️ | ➖ | ➖ |
92
-
| iOS | ✔️ |⚠️ | ✔️ | ✔️ | ➖ |
99
+
| iOS | ✔️ |✔️ | ✔️ | ✔️ | ➖ |
93
100
94
101
✔️ *: Supported* | ⚠️ *: Warning , see below* | ❌ *: not supported* | ➖ *: Not applicable*
95
102
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.
97
104
* Internet Explorer does not work for Unity WebGL builds, since it does not support wasm.
98
105
* 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.
99
106
100
107
## Notes
101
108
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/
102
110
* 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.
103
111
* 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
+

104
118
* 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))
105
119
* You might need to reload the page on android/iOS when running the first time
106
120
* 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/).
108
122
* Removing the default skybox will save ~30kb.
109
123
* 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.
110
124
111
125
### URP
112
126
* URP adds additional ~2.5 MB file size compared to the builtin render pipeline.
113
-
114
127
* In general the performance for URP seems to be better compared to builtin, but it has a larger build size.
115
-
116
128
* With Unity 2021.2 there is currently a problem with shader compilation and therefore builds fail:
117
-
118
129
```
119
130
Shader error in 'Hidden/Universal/CoreBlit': invalid subscript 'positionCS' at
120
131
UnityWebGL-LoadingTest/Library/PackageCache/[email protected]/Runtime/Utilities/Blit.hlsl(92) (on gles)
* 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
-
135
144
* Unity 2022.1 has problems building for URP with WebGL1 (also on desktop), error:
136
-
137
145
```
138
146
Texture creation failed. 'ShadowAuto' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
139
147
140
148
NullReferenceException: Object reference not set to an instance of an object.
141
149
```
142
-
143
-
144
150
145
151
### Min Size builds
146
152
* Built with `Tools/Build WebGL/minsize`
@@ -172,7 +178,10 @@ unityGame.SendMessage("WebGL", "Help"); -> Log all available commands
172
178
173
179
## Github Build Actions
174
180
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`
176
185
177
186
The following tags are supported:
178
187
@@ -181,16 +190,15 @@ The following tags are supported:
181
190
*`webgl1`: Build for WebGL1
182
191
*`webgl2`: Build for WebGL2
183
192
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
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).
0 commit comments