Skip to content

Commit b2814ae

Browse files
committed
Add comments and cleanup code
1 parent 4d24320 commit b2814ae

11 files changed

+44
-50
lines changed

Assets/Scripts/ConstantRotation.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum UpdateType
2727
}
2828

2929
[Tooltip("Rotating absolute in world space or relative to the axes of the object\n" +
30-
"For root objects use self, same effect but more performant.")]
30+
"For root objects use self, same effect but more performant.")]
3131
[SerializeField]
3232
private Space space = Space.World;
3333

Assets/Scripts/Editor/BuildScript.cs

+13-11
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
namespace UnityBuilderAction
1212
{
1313
/// <summary>
14-
/// Used for building the project through CI
15-
/// Modified version from https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs
14+
/// Used for building the project through continuous integration (CI) or semi-automated through menu items
15+
/// Supports logging in the editor and highly configurable WebGL
16+
/// Modified version of <see href="https://github.com/game-ci/documentation/blob/main/example/BuildScript.cs">
17+
/// Tailored to the needs for <see href="https://github.com/JohannesDeml/UnityWebGL-LoadingTest">
1618
/// </summary>
1719
public static class BuildScript
1820
{
@@ -275,15 +277,15 @@ private static void ReportSummary(BuildSummary summary)
275277
$"Size: {summary.totalSize.ToString()} bytes{Eol}" +
276278
$"{Eol}";
277279

278-
if (summary.totalErrors == 0)
279-
{
280-
Log(summaryText);
281-
}
282-
else
283-
{
284-
LogError(summaryText);
285-
}
286-
}
280+
if (summary.totalErrors == 0)
281+
{
282+
Log(summaryText);
283+
}
284+
else
285+
{
286+
LogError(summaryText);
287+
}
288+
}
287289

288290
private static void ExitWithResult(BuildResult result)
289291
{

Assets/Scripts/Editor/BuildScriptMenu.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
namespace UnityBuilderAction
1717
{
1818
/// <summary>
19-
/// Unity menu items for building the project for WebGL with the build script
20-
/// Helpful for testing the CI behavior
19+
/// Menu items for <see cref="BuildScript"> to build the project in the editor
20+
/// Helpful for testing the CI behavior and semi-automated builds
2121
/// </summary>
2222
public class BuildScriptMenu
2323
{

Assets/Scripts/Editor/RemoveMobileSupportWarningWebBuild.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
namespace Supyrb
1818
{
1919
/// <summary>
20-
/// removes a warning popup for mobile builds, that this platform might not be supported:
20+
/// Removes a warning popup for mobile builds, that this platform might not be supported:
2121
/// "Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway."
22+
/// This warning only shows up for unity versions prior to 2020.1
2223
/// </summary>
2324
public class RemoveMobileSupportWarningWebBuild
2425
{

Assets/Scripts/Editor/UnityPackageScripts.cs

+20-15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
namespace UnityBuilderAction
1919
{
20+
/// <summary>
21+
/// Editor script to automatically update all packages in the project to the newest version
22+
/// Can be used in continuous integration (CI) or through menu items in the editor
23+
/// Uses non-blocking tasks, so you can continue working until the packages recompile
24+
/// </summary>
2025
public static class UnityPackageScripts
2126
{
2227
private static int ProgressId;
@@ -27,9 +32,9 @@ public static class UnityPackageScripts
2732
private static AddRequest AddRequest;
2833
private static Queue<string> PackagesToAdd;
2934
#endif
30-
35+
3136
private static bool IncludePrereleases;
32-
37+
3338
[MenuItem("Tools/Packages/Update to verified version")]
3439
public static void UpgradeAllPackagesToVerifiedVersion()
3540
{
@@ -43,11 +48,11 @@ public static void UpgradeAllPackagesToLatestCompatibleVersion()
4348
IncludePrereleases = true;
4449
StartPackageListUpdate();
4550
}
46-
51+
4752
private static void StartPackageListUpdate()
4853
{
4954
#if UNITY_2020_1_OR_NEWER
50-
ProgressId = Progress.Start("Update Packages",
55+
ProgressId = Progress.Start("Update Packages",
5156
$"Update all packages to latest version (Include Pre-Releases: {IncludePrereleases})");
5257
#endif
5358
ListRequest = Client.List();
@@ -63,7 +68,7 @@ private static void OnWaitForPackageList()
6368
#endif
6469
return;
6570
}
66-
71+
6772
EditorApplication.update -= OnWaitForPackageList;
6873

6974
switch (ListRequest.Status)
@@ -99,10 +104,10 @@ private static void UpdatePackages()
99104
{
100105
continue;
101106
}
102-
103-
104-
string latestVersion = IncludePrereleases ?
105-
package.versions.latestCompatible :
107+
108+
109+
string latestVersion = IncludePrereleases ?
110+
package.versions.latestCompatible :
106111
#if UNITY_2019_3_OR_NEWER
107112
package.versions.verified;
108113
#else
@@ -112,7 +117,7 @@ private static void UpdatePackages()
112117
{
113118
continue;
114119
}
115-
120+
116121
Debug.Log($"Update {package.name} from {package.version} to {latestVersion}");
117122
toAdd.Add($"{package.name}@{latestVersion}");
118123
}
@@ -127,7 +132,7 @@ private static void UpdatePackages()
127132
#if UNITY_2020_1_OR_NEWER
128133
Progress.Report(ProgressId, 0.5f, $"Updating {toAdd.Count} packages: {string.Join(", ", toAdd)}");
129134
#endif
130-
135+
131136
#if UNITY_2021_2_OR_NEWER
132137
AddAndRemoveRequest = Client.AddAndRemove(toAdd.ToArray(), toRemove.ToArray());
133138
EditorApplication.update += OnWaitForPackageUpdates;
@@ -148,7 +153,7 @@ private static void OnWaitForPackageUpdates()
148153
{
149154
return;
150155
}
151-
156+
152157
EditorApplication.update -= OnWaitForPackageUpdates;
153158

154159
switch (AddAndRemoveRequest.Status)
@@ -172,7 +177,7 @@ private static void OnWaitForPackageUpdates()
172177
}
173178
}
174179
#else
175-
180+
176181
private static void OnWaitForSinglePackageUpdate()
177182
{
178183
#if UNITY_2020_1_OR_NEWER
@@ -215,7 +220,7 @@ private static void OnWaitForSinglePackageUpdate()
215220
}
216221
}
217222
#endif
218-
223+
219224
private static void EndUpdate(int returnValue)
220225
{
221226
#if UNITY_2020_1_OR_NEWER
@@ -231,7 +236,7 @@ private static void EndUpdate(int returnValue)
231236
{
232237
throw new Exception($"BuildScript ended with non-zero exitCode: {returnValue}");
233238
}
234-
239+
235240
Debug.Log($"Successfully updated packages");
236241
}
237242
}

Assets/WebGLTemplates/Develop/LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Licensed under MIT, Copyright Johannes Deml 2021-2023
2+
Template from https://github.com/JohannesDeml/UnityWebGL-LoadingTest

Assets/WebGLTemplates/Develop/README.md.meta renamed to Assets/WebGLTemplates/Develop/LICENSE.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/WebGLTemplates/Develop/README.md

-9
This file was deleted.

Assets/WebGLTemplates/Release/LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Licensed under MIT, Copyright Johannes Deml 2021-2023
2+
Template from https://github.com/JohannesDeml/UnityWebGL-LoadingTest

Assets/WebGLTemplates/Release/README.md.meta renamed to Assets/WebGLTemplates/Release/LICENSE.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/WebGLTemplates/Release/README.md

-9
This file was deleted.

0 commit comments

Comments
 (0)