Skip to content

Commit ce4f59b

Browse files
committed
Merge branch 'master' of https://github.com/JohannesDeml/UnityWebGL-LoadingTest into 2021.3
2 parents 6847e33 + 76ed38d commit ce4f59b

File tree

3 files changed

+47
-33
lines changed

3 files changed

+47
-33
lines changed

.github/workflows/upgrade-unity.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ on:
1414
required: false
1515
type: boolean
1616
default: true
17-
urp:
18-
description: 'URP branch'
19-
required: true
20-
type: boolean
21-
default: false
2217
tagsOnly:
2318
description: 'Only create tags'
2419
required: true
@@ -175,28 +170,24 @@ jobs:
175170
UNITY_YEAR=${UNITY_VERSION:0:4}
176171
BRANCH_NAME=${GITHUB_REF#refs/heads/}
177172
173+
TAG_PREFIX=$UNITY_VERSION
178174
if [[ "$BRANCH_NAME" == *"urp"* ]]
179175
then
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
184-
git tag -a -f $UNITY_VERSION-urp-webgl2 -m "[Automated workflow] Created by upgrade-unity"
185-
git tag -a -f $UNITY_VERSION-urp-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
176+
TAG_PREFIX=$UNITY_VERSION-urp
177+
fi
178+
179+
if [[ "$UNITY_YEAR" < "2023" ]]
180+
then
181+
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
182+
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
186183
else
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
194-
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
195-
git push origin -f --tags
196-
197-
git tag -a -f $UNITY_VERSION-webgl2 -m "[Automated workflow] Created by upgrade-unity"
198-
git tag -a -f $UNITY_VERSION-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
184+
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
199185
fi
186+
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
187+
git push origin -f --tags
188+
189+
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
190+
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
200191
201192
git push origin -f --tags
202193
env:

Assets/Scripts/Editor/BuildScript.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ public static void Build(string[] args)
135135
{
136136
PlayerSettings.SetGraphicsAPIs(BuildTarget.WebGL, new[] { GraphicsDeviceType.OpenGLES2, GraphicsDeviceType.OpenGLES3 });
137137
}
138+
139+
#if UNITY_2023_1_OR_NEWER
140+
if (tagParameters.Contains("webgl1"))
141+
{
142+
Log("WebGL1 not supported anymore, choosing WebGL2 instead");
143+
}
144+
#endif
138145
}
139146

140147
break;

Assets/Scripts/Editor/BuildScriptMenu.cs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ public class BuildScriptMenu
2525
{
2626
"-projectPath", "",
2727
"-buildVersion", PlayerSettings.bundleVersion,
28-
"-androidVersionCode", PlayerSettings.Android.bundleVersionCode.ToString(CultureInfo.InvariantCulture)
28+
"-androidVersionCode", PlayerSettings.Android.bundleVersionCode.ToString(CultureInfo.InvariantCulture),
2929
};
3030

31+
// Unity 2023.1+ does not support webgl1 anymore
32+
#if !UNITY_2023_1_OR_NEWER
3133
[MenuItem("Tools/Build WebGL/webgl1")]
32-
public static void BuildWebGLDefault()
34+
public static void BuildWebGL1()
3335
{
3436
var parameters = new List<string>(baseParameters);
3537
string tag = $"{Application.unityVersion}-webgl1-manualBuild";
@@ -41,8 +43,8 @@ public static void BuildWebGLDefault()
4143
BuildWithParameters(parameters);
4244
}
4345

44-
[MenuItem("Tools/Build WebGL/minsize")]
45-
public static void BuildWebGLMinSize()
46+
[MenuItem("Tools/Build WebGL/minsize-webgl1")]
47+
public static void BuildWebGL1MinSize()
4648
{
4749
var parameters = new List<string>(baseParameters);
4850
string tag = $"{Application.unityVersion}-minsize-webgl1-manualBuild";
@@ -53,12 +55,13 @@ public static void BuildWebGLMinSize()
5355
SetParameterValue("-customBuildName", tag, ref parameters);
5456
BuildWithParameters(parameters);
5557
}
58+
#endif
5659

57-
[MenuItem("Tools/Build WebGL/debug")]
58-
public static void BuildWebGLDebug()
60+
[MenuItem("Tools/Build WebGL/webgl2")]
61+
public static void BuildWebGL2()
5962
{
6063
var parameters = new List<string>(baseParameters);
61-
string tag = $"{Application.unityVersion}-debug-manualBuild";
64+
string tag = $"{Application.unityVersion}-webgl2-manualBuild";
6265
SetBuildTarget(BuildTarget.WebGL, ref parameters);
6366
SetParameterValue("-autorunplayer", "true", ref parameters);
6467
SetParameterValue("-tag", tag, ref parameters);
@@ -67,11 +70,24 @@ public static void BuildWebGLDebug()
6770
BuildWithParameters(parameters);
6871
}
6972

70-
[MenuItem("Tools/Build WebGL/webgl2")]
71-
public static void BuildWebGLWebGL2()
73+
[MenuItem("Tools/Build WebGL/minsize-webgl2")]
74+
public static void BuildWebGL2MinSize()
7275
{
7376
var parameters = new List<string>(baseParameters);
74-
string tag = $"{Application.unityVersion}-webgl2-manualBuild";
77+
string tag = $"{Application.unityVersion}-minsize-webgl2-manualBuild";
78+
SetBuildTarget(BuildTarget.WebGL, ref parameters);
79+
SetParameterValue("-autorunplayer", "true", ref parameters);
80+
SetParameterValue("-tag", tag, ref parameters);
81+
SetParameterValue("-customBuildPath", $"Builds/WebGL/{tag}", ref parameters);
82+
SetParameterValue("-customBuildName", tag, ref parameters);
83+
BuildWithParameters(parameters);
84+
}
85+
86+
[MenuItem("Tools/Build WebGL/debug")]
87+
public static void BuildWebGLDebug()
88+
{
89+
var parameters = new List<string>(baseParameters);
90+
string tag = $"{Application.unityVersion}-debug-manualBuild";
7591
SetBuildTarget(BuildTarget.WebGL, ref parameters);
7692
SetParameterValue("-autorunplayer", "true", ref parameters);
7793
SetParameterValue("-tag", tag, ref parameters);

0 commit comments

Comments
 (0)