Skip to content

Commit 88b5dbb

Browse files
committed
Merge branch 'master' into 6000.3-urp
# Conflicts: # Packages/manifest.json # Packages/packages-lock.json
2 parents 4197361 + 0cf2bed commit 88b5dbb

17 files changed

Lines changed: 262 additions & 40 deletions

File tree

.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/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/Plugins/WebGL/WebBridge/CommonCommands.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,17 @@ public void CheckOnlineStatus()
382382
Debug.Log($"<color=#4D65A4>Online Status:</color> {(isOnline ? "<color=#3bb508>Connected</color>" : "<color=#b50808>Disconnected</color>")}");
383383
}
384384

385+
/// <summary>
386+
/// Sets the CSS cursor style for the Unity canvas element.
387+
/// Browser Usage: <code>unityGame.SendMessage("WebGL", "SetCursor", "pointer");</code>
388+
/// </summary>
389+
/// <param name="cursorName">CSS cursor value (e.g., "default", "pointer", "grab", "crosshair", "text")</param>
390+
[WebCommand(Description = "Set the CSS cursor style")]
391+
public void SetCursor(string cursorName)
392+
{
393+
WebToolPlugins.SetCursor(cursorName);
394+
}
395+
385396
/// <summary>
386397
/// Captures the current screen and saves it as a PNG file.
387398
/// </summary>

Assets/Plugins/WebGL/WebTools/EventListeners/WebEventListeners.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using System;
1212
using System.Collections.Generic;
13+
using System.Diagnostics;
1314
using System.Runtime.InteropServices;
1415
using UnityEngine;
1516

@@ -36,6 +37,7 @@ private static void OnBeforeSceneLoadRuntimeMethod()
3637
}
3738
#endif
3839

40+
[Conditional("UNITY_WEBGL")]
3941
public static void AddEventListener(string eventName, Action callback)
4042
{
4143
instance.AddEventListenerInternal(eventName, callback);
@@ -59,7 +61,7 @@ private void AddEventListenerInternal(string eventName, Action callback)
5961
// Add event listener on javascript side
6062
_AddJsEventListener(eventName);
6163
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
62-
Debug.Log($"<color=#00CCCC>{nameof(WebEventListeners)}.{nameof(AddEventListenerInternal)} add callback for {eventName}</color>");
64+
UnityEngine.Debug.Log($"<color=#00CCCC>{nameof(WebEventListeners)}.{nameof(AddEventListenerInternal)} add callback for {eventName}</color>");
6365
#endif
6466
}
6567
}

Assets/Plugins/WebGL/WebTools/WebToolPlugins.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public static class WebToolPlugins
4444
private static extern void _DownloadFile(string filename, string content);
4545
[DllImport("__Internal")]
4646
private static extern void _DownloadBlob(string filename, byte[] byteArray, int byteLength, string mimeType);
47+
[DllImport("__Internal")]
48+
private static extern void _SetCursor(string cursorName);
4749

4850
#endif
4951

@@ -305,5 +307,28 @@ public static void DownloadBinaryFile(string filename, byte[] data, string mimeT
305307
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(DownloadBinaryFile)} called with filename: {filename}");
306308
#endif
307309
}
310+
311+
/// <summary>
312+
/// Sets the CSS cursor style for the Unity canvas element.
313+
/// <see href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor"/>
314+
/// </summary>
315+
/// <param name="cursorName">The CSS cursor value (e.g., "pointer", "grab", "crosshair", "text", "default")</param>
316+
/// <example>
317+
/// <code>
318+
/// // Example: Change cursor to pointer on hover
319+
/// WebToolPlugins.SetCursor("pointer");
320+
///
321+
/// // Example: Reset to default cursor
322+
/// WebToolPlugins.SetCursor("default");
323+
/// </code>
324+
/// </example>
325+
public static void SetCursor(string cursorName)
326+
{
327+
#if UNITY_WEBGL && !UNITY_EDITOR
328+
_SetCursor(cursorName);
329+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
330+
Debug.Log($"{nameof(WebToolPlugins)}.{nameof(SetCursor)} called with cursor: {cursorName}");
331+
#endif
332+
}
308333
}
309334
}

Assets/Plugins/WebGL/WebTools/WebToolPlugins.jslib

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ var WebGlPlugins =
154154
element.click();
155155
document.body.removeChild(element);
156156
URL.revokeObjectURL(url);
157+
},
158+
159+
_SetCursor: function(cursorName) {
160+
var cursorStr = UTF8ToString(cursorName);
161+
// Check if canvas variable exists from the Unity template
162+
var canvasElement = (typeof canvas !== 'undefined') ? canvas : null;
163+
if (!canvasElement) {
164+
canvasElement = document.getElementById('unity-canvas');
165+
}
166+
if (!canvasElement) {
167+
canvasElement = document.querySelector('canvas');
168+
}
169+
if (canvasElement) {
170+
canvasElement.style.cursor = cursorStr;
171+
}
157172
}
158173
};
159174

Assets/Prefabs/RigidbodyCube.prefab

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GameObject:
1313
- component: {fileID: 23875290202771946}
1414
- component: {fileID: 65366149667932608}
1515
- component: {fileID: 54003196623453922}
16+
- component: {fileID: 265791508532593724}
1617
m_Layer: 0
1718
m_Name: RigidbodyCube
1819
m_TagString: Untagged
@@ -136,3 +137,17 @@ Rigidbody:
136137
m_Interpolate: 0
137138
m_Constraints: 0
138139
m_CollisionDetection: 1
140+
--- !u!114 &265791508532593724
141+
MonoBehaviour:
142+
m_ObjectHideFlags: 0
143+
m_CorrespondingSourceObject: {fileID: 0}
144+
m_PrefabInstance: {fileID: 0}
145+
m_PrefabAsset: {fileID: 0}
146+
m_GameObject: {fileID: 1293945906612296}
147+
m_Enabled: 1
148+
m_EditorHideFlags: 0
149+
m_Script: {fileID: 11500000, guid: 7cd0ca8b7204d4214b198040d886c542, type: 3}
150+
m_Name:
151+
m_EditorClassIdentifier:
152+
CursorEnteredName: pointer
153+
CursorExitedName: default

Assets/Scenes/Main.unity

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OcclusionCullingSettings:
1313
--- !u!104 &2
1414
RenderSettings:
1515
m_ObjectHideFlags: 0
16-
serializedVersion: 9
16+
serializedVersion: 10
1717
m_Fog: 0
1818
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
1919
m_FogMode: 3
@@ -38,13 +38,12 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
4241
m_UseRadianceAmbientProbe: 0
4342
--- !u!157 &3
4443
LightmapSettings:
4544
m_ObjectHideFlags: 0
46-
serializedVersion: 12
47-
m_GIWorkflowMode: 0
45+
serializedVersion: 13
46+
m_BakeOnSceneLoad: 0
4847
m_GISettings:
4948
serializedVersion: 2
5049
m_BounceScale: 1
@@ -67,9 +66,6 @@ LightmapSettings:
6766
m_LightmapParameters: {fileID: 0}
6867
m_LightmapsBakeMode: 1
6968
m_TextureCompression: 1
70-
m_FinalGather: 0
71-
m_FinalGatherFiltering: 1
72-
m_FinalGatherRayCount: 256
7369
m_ReflectionCompression: 2
7470
m_MixedBakeMode: 2
7571
m_BakeBackend: 1
@@ -199,9 +195,8 @@ Light:
199195
m_PrefabAsset: {fileID: 0}
200196
m_GameObject: {fileID: 170076733}
201197
m_Enabled: 1
202-
serializedVersion: 10
198+
serializedVersion: 11
203199
m_Type: 1
204-
m_Shape: 0
205200
m_Color: {r: 0.99215686, g: 0.96962065, b: 0.85490197, a: 1}
206201
m_Intensity: 0.7
207202
m_Range: 10
@@ -251,8 +246,12 @@ Light:
251246
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
252247
m_UseBoundingSphereOverride: 0
253248
m_UseViewFrustumForShadowCasterCull: 1
249+
m_ForceVisible: 0
254250
m_ShadowRadius: 0
255251
m_ShadowAngle: 0
252+
m_LightUnit: 1
253+
m_LuxAtDistance: 1
254+
m_EnableSpotReflector: 1
256255
--- !u!4 &170076735
257256
Transform:
258257
m_ObjectHideFlags: 0
@@ -426,6 +425,7 @@ GameObject:
426425
- component: {fileID: 624999761}
427426
- component: {fileID: 624999760}
428427
- component: {fileID: 624999759}
428+
- component: {fileID: 624999763}
429429
m_Layer: 0
430430
m_Name: GroundPlane
431431
m_TagString: Untagged
@@ -472,6 +472,9 @@ MeshRenderer:
472472
m_ReflectionProbeUsage: 1
473473
m_RayTracingMode: 2
474474
m_RayTraceProcedural: 0
475+
m_RayTracingAccelStructBuildFlagsOverride: 0
476+
m_RayTracingAccelStructBuildFlags: 1
477+
m_SmallMeshCulling: 1
475478
m_RenderingLayerMask: 4294967295
476479
m_RendererPriority: 0
477480
m_Materials:
@@ -520,6 +523,21 @@ Transform:
520523
m_Children: []
521524
m_Father: {fileID: 0}
522525
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
526+
--- !u!114 &624999763
527+
MonoBehaviour:
528+
m_ObjectHideFlags: 0
529+
m_CorrespondingSourceObject: {fileID: 0}
530+
m_PrefabInstance: {fileID: 0}
531+
m_PrefabAsset: {fileID: 0}
532+
m_GameObject: {fileID: 624999758}
533+
m_Enabled: 1
534+
m_EditorHideFlags: 0
535+
m_Script: {fileID: 11500000, guid: 7cd0ca8b7204d4214b198040d886c542, type: 3}
536+
m_Name:
537+
m_EditorClassIdentifier:
538+
CursorEnteredName: grab
539+
CursorExitedName: default
540+
DestroyOnClick: 0
523541
--- !u!1 &1116415927
524542
GameObject:
525543
m_ObjectHideFlags: 0
@@ -926,6 +944,7 @@ GameObject:
926944
- component: {fileID: 2066011077}
927945
- component: {fileID: 2066011076}
928946
- component: {fileID: 2066011080}
947+
- component: {fileID: 2066011081}
929948
m_Layer: 0
930949
m_Name: RotatingCube
931950
m_TagString: Untagged
@@ -971,6 +990,9 @@ MeshRenderer:
971990
m_ReflectionProbeUsage: 1
972991
m_RayTracingMode: 2
973992
m_RayTraceProcedural: 0
993+
m_RayTracingAccelStructBuildFlagsOverride: 0
994+
m_RayTracingAccelStructBuildFlags: 1
995+
m_SmallMeshCulling: 1
974996
m_RenderingLayerMask: 4294967295
975997
m_RendererPriority: 0
976998
m_Materials:
@@ -1035,6 +1057,21 @@ MonoBehaviour:
10351057
rotationAxis: {x: 0, y: 1, z: 0}
10361058
degreePerSecond: 90
10371059
updateType: 0
1060+
--- !u!114 &2066011081
1061+
MonoBehaviour:
1062+
m_ObjectHideFlags: 0
1063+
m_CorrespondingSourceObject: {fileID: 0}
1064+
m_PrefabInstance: {fileID: 0}
1065+
m_PrefabAsset: {fileID: 0}
1066+
m_GameObject: {fileID: 2066011075}
1067+
m_Enabled: 1
1068+
m_EditorHideFlags: 0
1069+
m_Script: {fileID: 11500000, guid: 7cd0ca8b7204d4214b198040d886c542, type: 3}
1070+
m_Name:
1071+
m_EditorClassIdentifier:
1072+
CursorEnteredName: pointer
1073+
CursorExitedName: default
1074+
DestroyOnClick: 1
10381075
--- !u!1660057539 &9223372036854775807
10391076
SceneRoots:
10401077
m_ObjectHideFlags: 0

0 commit comments

Comments
 (0)