Skip to content

Commit 5f5237b

Browse files
committed
Merge branch 'master' into 6000.0-urp
2 parents ef477ac + 57246f5 commit 5f5237b

File tree

8 files changed

+118
-65
lines changed

8 files changed

+118
-65
lines changed

.github/scripts/add-tags.sh

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# example usage
44
# sh add-tags.sh "6000.0.0f1" -> Creates tags for non-urp version
55
# sh add-tags.sh "6000.0.0f1" "true" -> Creates tags for urp version
6+
# sh add-tags.sh "6000.0.0f1" "true" "10" -> Creates tags for urp version with 10 second delay between pushes
67

78
# Input parameters
89
UNITY_VERSION=$1
910
IS_URP=${2:-"false"}
10-
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP"
11+
DELAY_TAGS=${3:-"0"}
12+
13+
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP, DELAY_TAGS: $DELAY_TAGS seconds"
1114

1215
# Extract the value before the first dot as an integer
1316
MAJOR_VERSION=$(echo $UNITY_VERSION | cut -d. -f1)
@@ -19,22 +22,42 @@ then
1922
TAG_PREFIX=$UNITY_VERSION-urp
2023
fi
2124

25+
# Build array of tags to create and push
26+
TAGS=()
27+
2228
if [[ "$MAJOR_VERSION" -lt "2023" ]]
2329
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"
30+
TAGS+=("$TAG_PREFIX-minsize-webgl1")
31+
TAGS+=("$TAG_PREFIX-webgl1")
2632
else
27-
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
33+
TAGS+=("$TAG_PREFIX-minsize-webgl2")
2834
fi
29-
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
30-
git push origin -f --tags
3135

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"
36+
TAGS+=("$TAG_PREFIX-webgl2")
37+
TAGS+=("$TAG_PREFIX-webgl2-debug")
3438

3539
if [[ "$MAJOR_VERSION" -ge "6000" ]]
3640
then
37-
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
41+
TAGS+=("$TAG_PREFIX-webgpu")
3842
fi
3943

40-
git push origin -f --tags
44+
# Loop through tags, create and push each one with delay
45+
for i in "${!TAGS[@]}"; do
46+
TAG="${TAGS[$i]}"
47+
echo "Creating and pushing tag: $TAG"
48+
49+
# Create the tag
50+
git tag -a -f "$TAG" -m "[Automated workflow] Created by upgrade-unity"
51+
52+
# Push the tag
53+
git push origin -f "$TAG"
54+
55+
# Wait between pushes if not the last tag and delay is specified
56+
if [[ $i -lt $((${#TAGS[@]} - 1)) ]] && [[ "$DELAY_TAGS" -gt "0" ]]
57+
then
58+
echo "Waiting $DELAY_TAGS seconds before next tag push..."
59+
sleep $DELAY_TAGS
60+
fi
61+
done
62+
63+
echo "All tags created and pushed successfully."

.github/workflows/release.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121
with:
22-
fetch-depth: 0
23-
lfs: true
22+
sparse-checkout: |
23+
ProjectSettings/ProjectVersion.txt
2424
2525
- name: Set unity version
2626
id: set_unity_version
@@ -76,7 +76,6 @@ jobs:
7676
steps:
7777
- uses: actions/checkout@v4
7878
with:
79-
fetch-depth: 0
8079
lfs: true
8180

8281
# Avoid running into space issues for github runners - Docker images can take up quite some space
@@ -166,9 +165,6 @@ jobs:
166165
if: ${{ github.repository_owner == 'JohannesDeml' }}
167166
runs-on: ubuntu-latest
168167
steps:
169-
- name: Checkout code
170-
uses: actions/checkout@v4
171-
172168
- uses: actions/download-artifact@v4
173169
with:
174170
name: ${{ needs.variables.outputs.BUILD_NAME }}

.github/workflows/upgrade-unity.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
required: false
3030
type: string
3131
default: '-accept-apiupdate'
32+
delayTags:
33+
description: 'Delay between tag pushes (in seconds, minimum 1)'
34+
required: false
35+
type: number
36+
default: 1
3237

3338
jobs:
3439
upgrade-unity-version:
@@ -45,6 +50,7 @@ jobs:
4550
echo "Only create tags: $TAGS_ONLY"
4651
echo "Merge master into branch: $MERGE_MASTER"
4752
echo "Custom cli arguments: $CUSTOM_PARAMETERS"
53+
echo "Delay tags: $DELAY_TAGS seconds"
4854
if [[ "$BRANCH_NAME" == *"urp"* ]]
4955
then
5056
echo "urp: true"
@@ -57,6 +63,7 @@ jobs:
5763
TAGS_ONLY: ${{ inputs.tagsOnly }}
5864
MERGE_MASTER: ${{ inputs.mergeMaster }}
5965
CUSTOM_PARAMETERS: ${{ inputs.customParameters }}
66+
DELAY_TAGS: ${{ inputs.delayTags }}
6067

6168
- uses: actions/checkout@v4
6269
with:
@@ -205,8 +212,9 @@ jobs:
205212
IS_URP=true
206213
fi
207214
208-
# Run add tags script
209-
./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP"
215+
# Run add tags script with delay parameter
216+
./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP" "$DELAY_TAGS"
210217
env:
211218
UNITY_VERSION: ${{ inputs.unityVersion }}
219+
DELAY_TAGS: ${{ inputs.delayTags }}
212220

Assets/Scripts/Editor/BuildScript.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ public static class BuildScript
3434
private static bool LogVerboseBatchMode = true;
3535
private static bool LogVerboseInEditor = false;
3636
private static readonly string CodeOptimizationSpeed =
37-
#if UNITY_2022_1_OR_NEWER
37+
#if UNITY_2022_3_OR_NEWER
3838
CodeOptimizationWebGL.RuntimeSpeedLTO.ToString();
3939
#else
4040
"speed";
4141
#endif
4242
private static readonly string CodeOptimizationSize =
43-
#if UNITY_2022_1_OR_NEWER
43+
#if UNITY_2022_3_OR_NEWER
4444
CodeOptimizationWebGL.DiskSizeLTO.ToString();
4545
#else
4646
"size";
4747
#endif
4848

4949
private static readonly string CodeOptimizationBuildTimes =
50-
#if UNITY_2022_1_OR_NEWER
50+
#if UNITY_2022_3_OR_NEWER
5151
CodeOptimizationWebGL.BuildTimes.ToString();
5252
#else
5353
"size";
@@ -384,6 +384,32 @@ private static void ReportSummary(BuildSummary summary)
384384
{
385385
LogError(summaryText);
386386
}
387+
388+
// Archive the build report to metadata folder
389+
ArchiveBuildReport(summary.outputPath);
390+
}
391+
392+
private static void ArchiveBuildReport(string buildOutputPath)
393+
{
394+
try
395+
{
396+
string buildReportPath = "Library/LastBuild.buildreport";
397+
if (!File.Exists(buildReportPath))
398+
{
399+
LogWarning($"Build report not found at {buildReportPath}");
400+
return;
401+
}
402+
403+
string destinationFolder = Path.Combine(buildOutputPath, "metadata");
404+
Directory.CreateDirectory(destinationFolder);
405+
string destinationPath = Path.Combine(destinationFolder, "LastBuild.buildreport");
406+
File.Copy(buildReportPath, destinationPath, true);
407+
Log($"Build report archived to: {destinationPath}");
408+
}
409+
catch (Exception ex)
410+
{
411+
LogWarning($"Failed to archive build report: {ex.Message}");
412+
}
387413
}
388414

389415
private static void ExitWithResult(BuildResult result)

Assets/Scripts/ObjectSpawner.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System;
1212
using System.Collections.Generic;
1313
using UnityEngine;
14+
using UnityEngine.Assertions;
1415
using UnityEngine.SceneManagement;
1516

1617
namespace Supyrb
@@ -41,6 +42,7 @@ public float SpawnCoolDownSeconds
4142
get => spawnCoolDownSeconds;
4243
set
4344
{
45+
Assert.IsTrue(value > 0, $"Spawn cooldown needs to be greater than 0, but was set to {value}");
4446
spawnTimeBase += (spawnCoolDownSeconds - value) * totalSpawnCount;
4547
spawnCoolDownSeconds = value;
4648
}
@@ -79,7 +81,8 @@ private void Awake()
7981
private void Update()
8082
{
8183
float relativeSpawnTime = Time.time - spawnTimeBase;
82-
if (Mathf.FloorToInt(relativeSpawnTime / spawnCoolDownSeconds) > totalSpawnCount)
84+
int itemsToSpawn = Mathf.FloorToInt(relativeSpawnTime / spawnCoolDownSeconds) - totalSpawnCount;
85+
for(int i = 0; i < itemsToSpawn; i++)
8386
{
8487
SpawnObject();
8588
}
@@ -102,13 +105,7 @@ private void SpawnObject()
102105
if (spawnedObjects.Count >= maxInstances)
103106
{
104107
var recycleGo = spawnedObjects.Dequeue();
105-
if(recycleGo == null)
106-
{
107-
// If the spawned object was destroyed, we create a new one
108-
// Decrement spawn count since it will be incremented when created below
109-
totalSpawnCount--;
110-
}
111-
else
108+
if(recycleGo != null)
112109
{
113110
#if UNITY_2021_3_OR_NEWER
114111
recycleGo.transform.SetLocalPositionAndRotation(transform.position, transform.localRotation);
@@ -117,6 +114,7 @@ private void SpawnObject()
117114
recycleGo.transform.localRotation = transform.localRotation;
118115
#endif
119116
spawnedObjects.Enqueue(recycleGo);
117+
totalSpawnCount++;
120118
return;
121119
}
122120
}
-22.4 KB
Loading

Documentation/urp-build-sizes.png

-18 KB
Loading

README.md

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,57 +34,57 @@ BiRP Build Size | URP Build Size
3434

3535
Version | Size | Link
3636
--- | --- | ---
37-
6000.3.1f1 | 3.45 MB | https://deml.io/experiments/unity-webgl/6000.3.1f1-webgl2
38-
6000.2.10f1 | 3.39 MB | https://deml.io/experiments/unity-webgl/6000.2.10f1-webgl2
39-
6000.1.17f1 | 3.33 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-webgl2
40-
6000.0.62f1 | 3.33 MB | https://deml.io/experiments/unity-webgl/6000.0.62f1-webgl2
41-
2023.2.20f1 | 3.27 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-webgl2
42-
2023.1.20f1 | 3.19 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-webgl2
43-
2022.3.62f3 | 3.18 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-webgl2
44-
2022.2.18f1 | 3.06 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-webgl2
45-
2022.1.24f1 | 2.82 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-webgl2
46-
2021.3.45f2 | 2.83 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-webgl2
37+
6000.3.2f1 | 3.46 MB | https://deml.io/experiments/unity-webgl/6000.3.2f1-webgl2
38+
6000.2.15f1 | 3.40 MB | https://deml.io/experiments/unity-webgl/6000.2.15f1-webgl2
39+
6000.1.17f1 | 3.34 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-webgl2
40+
6000.0.64f1 | 3.34 MB | https://deml.io/experiments/unity-webgl/6000.0.64f1-webgl2
41+
2023.2.20f1 | 3.28 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-webgl2
42+
2023.1.20f1 | 3.20 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-webgl2
43+
2022.3.62f3 | 3.19 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-webgl2
44+
2022.2.18f1 | 3.11 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-webgl2
45+
2022.1.24f1 | 2.88 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-webgl2
46+
2021.3.45f2 | 2.84 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-webgl2
4747

4848

4949
### Built-in Renderpipeline WebGL1
5050

5151
Version | Size | Link
5252
--- | --- | ---
53-
2022.3.62f3 | 3.16 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-webgl1
54-
2022.2.18f1 | 3.04 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-webgl1
55-
2022.1.24f1 | 2.80 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-webgl1
56-
2021.3.45f2 | 2.81 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-webgl1
53+
2022.3.62f3 | 3.17 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-webgl1
54+
2022.2.18f1 | 3.09 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-webgl1
55+
2022.1.24f1 | 2.86 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-webgl1
56+
2021.3.45f2 | 2.82 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-webgl1
5757

5858

5959
### Built-in Renderpipeline Minimum size
6060

6161
Version | Size | Link
6262
--- | --- | ---
63-
6000.3.1f1 | 3.04 MB | https://deml.io/experiments/unity-webgl/6000.3.1f1-minsize-webgl2
64-
6000.2.10f1 | 2.92 MB | https://deml.io/experiments/unity-webgl/6000.2.10f1-minsize-webgl2
65-
6000.1.17f1 | 2.85 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-minsize-webgl2
66-
6000.0.62f1 | 2.93 MB | https://deml.io/experiments/unity-webgl/6000.0.62f1-minsize-webgl2
67-
2023.2.20f1 | 2.88 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-minsize-webgl2
68-
2023.1.20f1 | 2.76 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-minsize-webgl2
63+
6000.3.2f1 | 3.05 MB | https://deml.io/experiments/unity-webgl/6000.3.2f1-minsize-webgl2
64+
6000.2.15f1 | 2.92 MB | https://deml.io/experiments/unity-webgl/6000.2.15f1-minsize-webgl2
65+
6000.1.17f1 | 2.86 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-minsize-webgl2
66+
6000.0.64f1 | 2.94 MB | https://deml.io/experiments/unity-webgl/6000.0.64f1-minsize-webgl2
67+
2023.2.20f1 | 2.89 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-minsize-webgl2
68+
2023.1.20f1 | 2.77 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-minsize-webgl2
6969
2022.3.62f3 | 2.74 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-minsize-webgl1
70-
2022.2.18f1 | 2.69 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-minsize-webgl1
70+
2022.2.18f1 | 2.68 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-minsize-webgl1
7171
2022.1.24f1 | 2.64 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-minsize-webgl1
72-
2021.3.45f2 | 2.79 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-minsize-webgl1
72+
2021.3.45f2 | 2.66 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-minsize-webgl1
7373

7474

7575
### URP WebGL2
7676

7777
Version | Size | Link
7878
--- | --- | ---
79-
6000.3.1f1 | 8.22 MB | https://deml.io/experiments/unity-webgl/6000.3.1f1-urp-webgl2
80-
6000.2.10f1 | 8.13 MB | https://deml.io/experiments/unity-webgl/6000.2.10f1-urp-webgl2
79+
6000.3.2f1 | 8.23 MB | https://deml.io/experiments/unity-webgl/6000.3.2f1-urp-webgl2
80+
6000.2.15f1 | 8.13 MB | https://deml.io/experiments/unity-webgl/6000.2.15f1-urp-webgl2
8181
6000.1.17f1 | 7.97 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-urp-webgl2
82-
6000.0.62f1 | 7.94 MB | https://deml.io/experiments/unity-webgl/6000.0.62f1-urp-webgl2
82+
6000.0.64f1 | 7.94 MB | https://deml.io/experiments/unity-webgl/6000.0.64f1-urp-webgl2
8383
2023.2.20f1 | 6.88 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-urp-webgl2
84-
2023.1.20f1 | 6.26 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-urp-webgl2
85-
2022.3.62f3 | 5.98 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-urp-webgl2
86-
2022.2.18f1 | 7.22 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-urp-webgl2
87-
2022.1.24f1 | 6.47 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl2
84+
2023.1.20f1 | 6.29 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-urp-webgl2
85+
2022.3.62f3 | 5.99 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-urp-webgl2
86+
2022.2.18f1 | 7.27 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-urp-webgl2
87+
2022.1.24f1 | 6.51 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl2
8888
2021.3.45f2 | 6.36 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-urp-webgl2
8989

9090

@@ -93,23 +93,25 @@ Version | Size | Link
9393
Version | Size | Link
9494
--- | --- | ---
9595
2022.3.62f3 | 5.93 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-urp-webgl1
96-
2022.2.18f1 | 7.08 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-urp-webgl1
97-
2022.1.24f1 | 6.33 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl1
98-
2021.3.45f2 | 6.18 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-urp-webgl1
96+
2022.2.18f1 | 7.13 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-urp-webgl1
97+
2022.1.24f1 | 6.38 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-webgl1
98+
2021.3.45f2 | 6.17 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-urp-webgl1
9999

100100

101101
### URP Minimum Size
102102

103103
Version | Size | Link
104104
--- | --- | ---
105-
6000.3.1f1 | 6.30 MB | https://deml.io/experiments/unity-webgl/6000.3.1f1-urp-minsize-webgl2
105+
6000.3.2f1 | 6.30 MB | https://deml.io/experiments/unity-webgl/6000.3.2f1-urp-minsize-webgl2
106+
6000.2.15f1 | 6.24 MB | https://deml.io/experiments/unity-webgl/6000.2.15f1-urp-minsize-webgl2
106107
6000.1.17f1 | 5.64 MB | https://deml.io/experiments/unity-webgl/6000.1.17f1-urp-minsize-webgl2
107-
6000.0.62f1 | 6.10 MB | https://deml.io/experiments/unity-webgl/6000.0.62f1-urp-minsize-webgl2
108+
6000.0.64f1 | 6.11 MB | https://deml.io/experiments/unity-webgl/6000.0.64f1-urp-minsize-webgl2
108109
2023.2.20f1 | 5.33 MB | https://deml.io/experiments/unity-webgl/2023.2.20f1-urp-minsize-webgl2
109110
2023.1.20f1 | 4.88 MB | https://deml.io/experiments/unity-webgl/2023.1.20f1-urp-minsize-webgl2
110111
2022.3.62f3 | 4.69 MB | https://deml.io/experiments/unity-webgl/2022.3.62f3-urp-minsize-webgl1
111-
2022.1.24f1 | 6.06 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-minsize-webgl1
112-
2021.3.45f2 | 6.16 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-urp-minsize-webgl1
112+
2022.2.18f1 | 5.92 MB | https://deml.io/experiments/unity-webgl/2022.2.18f1-urp-minsize-webgl1
113+
2022.1.24f1 | 5.71 MB | https://deml.io/experiments/unity-webgl/2022.1.24f1-urp-minsize-webgl1
114+
2021.3.45f2 | 5.93 MB | https://deml.io/experiments/unity-webgl/2021.3.45f2-urp-minsize-webgl1
113115

114116

115117
## Platform Compatibility

0 commit comments

Comments
 (0)