From 8701f05e79dfe881a807585708cdedb473921676 Mon Sep 17 00:00:00 2001 From: BaalEvan Date: Wed, 13 Oct 2021 00:44:56 +0200 Subject: [PATCH] Added ToString() override based on PointerInputModule - 2025 # Conflicts: # Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs --- .../Plugins/UI/InputSystemUIInputModule.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs index 667a833494..92733de82e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs @@ -31,8 +31,6 @@ ////TODO: add ability to query which device was last used with any of the actions ////REVIEW: also give access to the last/current UI event? -////TODO: ToString() method a la PointerInputModule - namespace UnityEngine.InputSystem.UI { /// @@ -2616,6 +2614,22 @@ public InputActionAsset actionsAsset } } + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("Pointer Input Module of type: " + (object) this.GetType()); + stringBuilder.AppendLine(); + + foreach (PointerModel keyValuePair in this.m_PointerStates) + { + if (keyValuePair.eventData != null) + { + stringBuilder.AppendLine("Pointer: " + (object) keyValuePair.screenPosition); + stringBuilder.AppendLine(keyValuePair.eventData.ToString()); + } + } + return stringBuilder.ToString(); + } + [SerializeField, HideInInspector] private InputActionAsset m_ActionsAsset; [SerializeField, HideInInspector] private InputActionReference m_PointAction; [SerializeField, HideInInspector] private InputActionReference m_MoveAction;