Skip to content

Commit 7738a6e

Browse files
committed
Merge branch 'master' into 2020.3-urp
2 parents 395cdc0 + 2cfb179 commit 7738a6e

File tree

6 files changed

+65
-21
lines changed

6 files changed

+65
-21
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
restore-keys: Library-201x-
9393

9494
- name: Build project
95-
uses: game-ci/unity-builder@v2
95+
uses: game-ci/unity-builder@v3
9696
env:
9797
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
9898
with:

.github/workflows/upgrade-unity.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,23 @@ jobs:
4444
steps:
4545
- name: Log input parameter
4646
run: |
47+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
48+
49+
echo "Branch: $BRANCH_NAME"
4750
echo "Unity version: $UNITY_VERSION"
4851
echo "Create tags: $CREATE_TAGS"
49-
echo "URP branch: $URP_BRANCH"
5052
echo "Only create tags: $TAGS_ONLY"
5153
echo "Merge master into branch: $MERGE_MASTER"
5254
echo "Custom cli arguments: $CUSTOM_PARAMETERS"
55+
if [[ "$BRANCH_NAME" == *"urp"* ]]
56+
then
57+
echo "urp: true"
58+
else
59+
echo "urp: false"
60+
fi
5361
env:
5462
UNITY_VERSION: ${{ inputs.unityVersion }}
5563
CREATE_TAGS: ${{ inputs.createTags }}
56-
URP_BRANCH: ${{ inputs.urp }}
5764
TAGS_ONLY: ${{ inputs.tagsOnly }}
5865
MERGE_MASTER: ${{ inputs.mergeMaster }}
5966
CUSTOM_PARAMETERS: ${{ inputs.customParameters }}
@@ -77,7 +84,7 @@ jobs:
7784
- name: Merge master into current branch
7885
if: ${{ inputs.mergeMaster }}
7986
run: |
80-
git fetch origin master --depth=1
87+
git fetch origin master
8188
git merge FETCH_HEAD
8289
git push
8390
@@ -107,15 +114,15 @@ jobs:
107114
- name: Set upgrade name
108115
id: upgrade_name
109116
run: |
110-
if [[ "$URP_BRANCH" == "true" ]]
117+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
118+
if [[ "$BRANCH_NAME" == *"urp"* ]]
111119
then
112120
echo "NAME=$UNITY_VERSION-urp" >> $GITHUB_OUTPUT
113121
else
114122
echo "NAME=$UNITY_VERSION" >> $GITHUB_OUTPUT
115123
fi
116124
env:
117125
UNITY_VERSION: ${{ inputs.unityVersion }}
118-
URP_BRANCH: ${{ inputs.urp }}
119126

120127
- name: Log variables
121128
run: |
@@ -124,7 +131,8 @@ jobs:
124131
125132
- name: Build project
126133
if: ${{ !inputs.tagsOnly }}
127-
uses: JohannesDeml/unity-builder@no-quit-parameter
134+
# TODO change this back to v3 once manual exit is supported there
135+
uses: game-ci/unity-builder@main
128136
env:
129137
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
130138
with:
@@ -134,6 +142,7 @@ jobs:
134142
targetPlatform: WebGL
135143
buildName: ${{ needs.variables.outputs.BUILD_NAME }}
136144
allowDirtyBuild: true
145+
manualExit: true
137146

138147
- name: Delete build folder with elevated rights
139148
if: ${{ !inputs.tagsOnly }}
@@ -162,22 +171,34 @@ jobs:
162171
- name: Add tags
163172
if: ${{ inputs.createTags || inputs.tagsOnly }}
164173
run: |
165-
if [[ "$URP_BRANCH" == "true" ]]
174+
# Extract the first four characters of UNITY_VERSION
175+
UNITY_YEAR=${UNITY_VERSION:0:4}
176+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
177+
178+
if [[ "$BRANCH_NAME" == *"urp"* ]]
166179
then
167-
git tag -a -f $UNITY_VERSION-urp-webgl1 -m "[Automated workflow] Created by upgrade-unity"
180+
if [[ "$UNITY_YEAR" < "2023" ]]
181+
then
182+
git tag -a -f $UNITY_VERSION-urp-webgl1 -m "[Automated workflow] Created by upgrade-unity"
183+
fi
168184
git tag -a -f $UNITY_VERSION-urp-webgl2 -m "[Automated workflow] Created by upgrade-unity"
169185
git tag -a -f $UNITY_VERSION-urp-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
170186
else
171-
git tag -a -f $UNITY_VERSION-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
172-
git tag -a -f $UNITY_VERSION-webgl1 -m "[Automated workflow] Created by upgrade-unity"
173-
git tag -a -f $UNITY_VERSION-webgl2 -m "[Automated workflow] Created by upgrade-unity"
187+
if [[ "$UNITY_YEAR" < "2023" ]]
188+
then
189+
git tag -a -f $UNITY_VERSION-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
190+
git tag -a -f $UNITY_VERSION-webgl1 -m "[Automated workflow] Created by upgrade-unity"
191+
else
192+
git tag -a -f $UNITY_VERSION-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
193+
fi
174194
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
175195
git push origin -f --tags
196+
197+
git tag -a -f $UNITY_VERSION-webgl2 -m "[Automated workflow] Created by upgrade-unity"
176198
git tag -a -f $UNITY_VERSION-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
177199
fi
178200
179201
git push origin -f --tags
180202
env:
181203
UNITY_VERSION: ${{ inputs.unityVersion }}
182-
URP_BRANCH: ${{ inputs.urp }}
183204

Assets/Scripts/Editor/BuildScript.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace UnityBuilderAction
2323
/// <summary>
2424
/// Used for building the project through continuous integration (CI) or semi-automated through menu items
2525
/// Supports logging in the editor and highly configurable WebGL
26-
/// Modified version of <see href="https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs">
27-
/// Tailored to the needs for <see href="https://github.com/JohannesDeml/UnityWebGL-LoadingTest">
26+
/// Modified version of <see href="https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs" />
27+
/// Tailored to the needs for <see href="https://github.com/JohannesDeml/UnityWebGL-LoadingTest" />
2828
/// </summary>
2929
public static class BuildScript
3030
{
@@ -108,6 +108,10 @@ public static void Build(string[] args)
108108
#else
109109
PlayerSettings.WebGL.debugSymbols = true;
110110
#endif
111+
112+
#if UNITY_2022_2_OR_NEWER
113+
PlayerSettings.WebGL.showDiagnostics = true;
114+
#endif
111115
buildPlayerOptions.options |= BuildOptions.Development;
112116
}
113117
else

Assets/Scripts/Editor/UnityPackageScripts.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ private static void UpdatePackages()
108108

109109
string latestVersion = IncludePrereleases ?
110110
package.versions.latestCompatible :
111-
#if UNITY_2019_3_OR_NEWER
111+
#if UNITY_2022_3_OR_NEWER
112+
package.versions.recommended;
113+
#elif UNITY_2019_3_OR_NEWER
112114
package.versions.verified;
113115
#else
114116
package.versions.recommended;
@@ -226,8 +228,24 @@ private static void EndUpdate(int returnValue)
226228
#if UNITY_2020_1_OR_NEWER
227229
Progress.Finish(ProgressId, returnValue == 0 ? Progress.Status.Succeeded : Progress.Status.Failed);
228230
#endif
231+
Debug.Log($"Updating unity packages finished with exit code {returnValue}");
232+
229233
if (Application.isBatchMode)
230234
{
235+
// Hack for unity-builder v3, since it is expecting a build result output
236+
Console.WriteLine(
237+
$"{Environment.NewLine}" +
238+
$"###########################{Environment.NewLine}" +
239+
$"# Build results #{Environment.NewLine}" +
240+
$"###########################{Environment.NewLine}" +
241+
$"{Environment.NewLine}" +
242+
$"Duration: 0{Environment.NewLine}" +
243+
$"Warnings: 0{Environment.NewLine}" +
244+
$"Errors: 0{Environment.NewLine}" +
245+
$"Size: 0 bytes{Environment.NewLine}" +
246+
$"{Environment.NewLine}"
247+
);
248+
231249
EditorApplication.Exit(returnValue);
232250
}
233251
else
@@ -236,8 +254,6 @@ private static void EndUpdate(int returnValue)
236254
{
237255
throw new Exception($"BuildScript ended with non-zero exitCode: {returnValue}");
238256
}
239-
240-
Debug.Log($"Successfully updated packages");
241257
}
242258
}
243259
}

Assets/WebGLTemplates/Develop/debug-console.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/// Processes all unity log messages and converts unity rich text to css styled console messages & adds a debug html debug console
2+
/// from https://github.com/JohannesDeml/UnityWebGL-LoadingTest
3+
14
let consoleDiv;
25
let debugToggle;
36
let logCounterDivs = {};

README.md

Lines changed: 3 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 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)
5+
[![](https://img.shields.io/github/release-date/JohannesDeml/UnityWebGL-LoadingTest.svg)](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/releases) [![Tested up to Unity 2022.3](https://img.shields.io/badge/tested%20up%20to%20unity-2022.3-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 - 2022.2) and platforms*
7+
*Testing Unity's WebGL size and loading time for different versions (2018.4 - 2022.3) 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/)
@@ -204,4 +204,4 @@ You can find a list of all live builds with their sizes over here: https://deml.
204204

205205
## License
206206

207-
* MIT (c) Johannes Deml - see [LICENSE](./LICENSE.md)
207+
* MIT (c) Johannes Deml - see [LICENSE](./LICENSE.md)

0 commit comments

Comments
 (0)