Skip to content

Commit 2504051

Browse files
committed
Merge branch 'master' of https://github.com/JohannesDeml/UnityWebGL-LoadingTest into 2022.3
2 parents 303107d + 77b054e commit 2504051

File tree

5 files changed

+58
-29
lines changed

5 files changed

+58
-29
lines changed

.github/scripts/add-tags.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# This script creates tags for the given unity version to trigger the release workflow
3+
# example usage
4+
# sh add-tags.sh "6000.0.0f1" -> Creates tags for non-urp version
5+
# sh add-tags.sh "6000.0.0f1" "true" -> Creates tags for urp version
6+
7+
# Input parameters
8+
UNITY_VERSION=$1
9+
IS_URP=${2:-"false"}
10+
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP"
11+
12+
# Extract the value before the first dot as an integer
13+
MAJOR_VERSION=$(echo $UNITY_VERSION | cut -d. -f1)
14+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
15+
16+
TAG_PREFIX=$UNITY_VERSION
17+
if [[ "$IS_URP" == "true" ]]
18+
then
19+
TAG_PREFIX=$UNITY_VERSION-urp
20+
fi
21+
22+
if [[ "$MAJOR_VERSION" -lt "2023" ]]
23+
then
24+
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
25+
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
26+
else
27+
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
28+
fi
29+
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
30+
git push origin -f --tags
31+
32+
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
33+
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
34+
35+
if [[ "$MAJOR_VERSION" -ge "6000" ]]
36+
then
37+
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
38+
fi
39+
40+
git push origin -f --tags

.github/workflows/upgrade-unity.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,35 +168,15 @@ jobs:
168168
- name: Add tags
169169
if: ${{ inputs.createTags || inputs.tagsOnly }}
170170
run: |
171-
# Extract the first four characters of UNITY_VERSION
172-
MAJOR_VERSION=${UNITY_VERSION:0:4}
173171
BRANCH_NAME=${GITHUB_REF#refs/heads/}
174172
175-
TAG_PREFIX=$UNITY_VERSION
176-
if [[ "$BRANCH_NAME" == *"urp"* ]]
177-
then
178-
TAG_PREFIX=$UNITY_VERSION-urp
179-
fi
180-
181-
if [[ "$MAJOR_VERSION" < "2023" ]]
182-
then
183-
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
184-
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
185-
else
186-
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
187-
fi
188-
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
189-
git push origin -f --tags
190-
191-
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
192-
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
193-
194-
if [[ "$MAJOR_VERSION" >= "6000" ]]
195-
then
196-
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
173+
IS_URP=false
174+
if [[ "$BRANCH_NAME" == *"urp"* ]]; then
175+
IS_URP=true
197176
fi
198177
199-
git push origin -f --tags
178+
# Run add tags script
179+
./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP"
200180
env:
201181
UNITY_VERSION: ${{ inputs.unityVersion }}
202182

Assets/WebGLTemplates/Develop/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="debug-console.css">
8+
<!-- Start loading assets right away, to have them (partly) loaded already when they are requested -->
9+
<link rel="preload" href="Build//{{{ DATA_FILENAME }}}" as="fetch" type="application/octet-stream" crossorigin>
10+
<link rel="preload" href="Build/{{{ FRAMEWORK_FILENAME }}}" as="script">
11+
<link rel="preload" href="Build/{{{ CODE_FILENAME }}}" as="fetch" type="application/wasm" crossorigin>
712
<title>{{{ PRODUCT_NAME }}}</title>
813
<style>
914
* {
@@ -113,7 +118,6 @@
113118
transition: 400ms linear;
114119
}
115120
</style>
116-
<link rel="stylesheet" href="debug-console.css">
117121
</head>
118122

119123
<body>

Assets/WebGLTemplates/Release/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<!-- Start loading assets right away, to have them (partly) loaded already when they are requested -->
8+
<link rel="preload" href="Build//{{{ DATA_FILENAME }}}" as="fetch" type="application/octet-stream" crossorigin>
9+
<link rel="preload" href="Build/{{{ FRAMEWORK_FILENAME }}}" as="script">
10+
<link rel="preload" href="Build/{{{ CODE_FILENAME }}}" as="fetch" type="application/wasm" crossorigin>
711
<title>{{{ PRODUCT_NAME }}}</title>
812
<style>
913
* {

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
![Preview](./preview.png)
44

5-
[![](https://img.shields.io/github/release-date/JohannesDeml/UnityWebGL-LoadingTest.svg)](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases) [![Tested up to Unity 2023.2](https://img.shields.io/badge/tested%20up%20to%20unity-2023.2-green.svg?logo=unity&cacheSeconds=2592000)](https://unity3d.com/get-unity/download/archive)
5+
[![](https://img.shields.io/github/release-date/JohannesDeml/UnityWebGL-LoadingTest.svg)](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases) [![Tested up to Unity 6](https://img.shields.io/badge/tested%20up%20to%20unity-6000.0-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 (2018.4 - 2023.2) and platforms*
7+
*Testing Unity's WebGL size and loading time for different versions (2018.4 - 6000.0) 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/)
@@ -26,6 +26,7 @@
2626
* Github Actions to automatically build the project and deploy it on the server via [Game CI](https://game.ci/)
2727
* Works with [Unity WebGL Publisher](https://play.unity.com/discover/all-showcases) (Use [2020.3-lts](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/2020-lts) or [2020.3-lts-urp](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/tree/2020-lts-urp) branch)
2828
* Tracking multiple Unity versions starting from 2018.4
29+
* Build targets for webgl1, webgl2 and webgpu
2930

3031
## Live Demos
3132

@@ -125,7 +126,7 @@ Version | Size | Link
125126
* There are some combinations for **iOS** that have **problems**: With recent versions **URP with WebGL 1** does not work at all and **builtin render pipeline 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/
126127
* 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.
127128
* The server is configured to support wasm streaming and brotli compression, see [.htaccess 2020](./Configuration/2020/.htaccess) [.htaccess 2019](./Configuration/2019/.htaccess)
128-
* Some servers (such as itch.io) don't support brotli compression, you should then use gzip compression instead. If brotli is misconfigured or not supported you will get an error along the lines of:
129+
* Due to the odd way that Unity does brotli compression, some servers (such as itch.io) don't support it, you should [learn how to manually compress your game](https://miltoncandelero.github.io/unity-webgl-compression) or use gzip compression instead. If brotli is misconfigured or not supported you will get an error along the lines of:
129130
```
130131
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.
131132
```

0 commit comments

Comments
 (0)