Skip to content

Commit cbde50f

Browse files
committed
Add grab cursor style when over GroundPlane
1 parent a8af4ca commit cbde50f

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Assets/Plugins/WebGL/WebTools/WebToolPlugins.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ public static void DownloadBinaryFile(string filename, byte[] data, string mimeT
310310

311311
/// <summary>
312312
/// 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"/>
313314
/// </summary>
314315
/// <param name="cursorName">The CSS cursor value (e.g., "pointer", "grab", "crosshair", "text", "default")</param>
315316
/// <example>

Assets/Scenes/Main.unity

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ GameObject:
370370
- component: {fileID: 624999761}
371371
- component: {fileID: 624999760}
372372
- component: {fileID: 624999759}
373+
- component: {fileID: 624999763}
373374
m_Layer: 0
374375
m_Name: GroundPlane
375376
m_TagString: Untagged
@@ -467,6 +468,21 @@ Transform:
467468
m_Children: []
468469
m_Father: {fileID: 0}
469470
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
471+
--- !u!114 &624999763
472+
MonoBehaviour:
473+
m_ObjectHideFlags: 0
474+
m_CorrespondingSourceObject: {fileID: 0}
475+
m_PrefabInstance: {fileID: 0}
476+
m_PrefabAsset: {fileID: 0}
477+
m_GameObject: {fileID: 624999758}
478+
m_Enabled: 1
479+
m_EditorHideFlags: 0
480+
m_Script: {fileID: 11500000, guid: 7cd0ca8b7204d4214b198040d886c542, type: 3}
481+
m_Name:
482+
m_EditorClassIdentifier:
483+
CursorEnteredName: grab
484+
CursorExitedName: default
485+
DestroyOnClick: 0
470486
--- !u!1 &1116415927
471487
GameObject:
472488
m_ObjectHideFlags: 0
@@ -1000,6 +1016,7 @@ MonoBehaviour:
10001016
m_EditorClassIdentifier:
10011017
CursorEnteredName: pointer
10021018
CursorExitedName: default
1019+
DestroyOnClick: 1
10031020
--- !u!1660057539 &9223372036854775807
10041021
SceneRoots:
10051022
m_ObjectHideFlags: 0

Assets/Scripts/ChangeCursorExample.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class ChangeCursorExample : MonoBehaviour
1616
{
1717
public string CursorEnteredName = "pointer";
1818
public string CursorExitedName = "default";
19+
public bool DestroyOnClick = true;
1920

2021
private void OnMouseEnter()
2122
{
@@ -29,7 +30,10 @@ private void OnMouseExit()
2930

3031
private void OnMouseDown()
3132
{
32-
Destroy(gameObject);
33+
if(DestroyOnClick)
34+
{
35+
Destroy(gameObject);
36+
}
3337
}
3438
}
3539
}

0 commit comments

Comments
 (0)