Skip to content

Commit 8701f05

Browse files
committed
Added ToString() override based on PointerInputModule - 2025
# Conflicts: # Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs
1 parent a0ed434 commit 8701f05

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
////TODO: add ability to query which device was last used with any of the actions
3232
////REVIEW: also give access to the last/current UI event?
3333

34-
////TODO: ToString() method a la PointerInputModule
35-
3634
namespace UnityEngine.InputSystem.UI
3735
{
3836
/// <summary>
@@ -2616,6 +2614,22 @@ public InputActionAsset actionsAsset
26162614
}
26172615
}
26182616

2617+
public override string ToString()
2618+
{
2619+
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("<b>Pointer Input Module of type: </b>" + (object) this.GetType());
2620+
stringBuilder.AppendLine();
2621+
2622+
foreach (PointerModel keyValuePair in this.m_PointerStates)
2623+
{
2624+
if (keyValuePair.eventData != null)
2625+
{
2626+
stringBuilder.AppendLine("<B>Pointer:</b> " + (object) keyValuePair.screenPosition);
2627+
stringBuilder.AppendLine(keyValuePair.eventData.ToString());
2628+
}
2629+
}
2630+
return stringBuilder.ToString();
2631+
}
2632+
26192633
[SerializeField, HideInInspector] private InputActionAsset m_ActionsAsset;
26202634
[SerializeField, HideInInspector] private InputActionReference m_PointAction;
26212635
[SerializeField, HideInInspector] private InputActionReference m_MoveAction;

0 commit comments

Comments
 (0)