diff --git a/XRTK-Core/Packages/com.xrtk.core/Interfaces/InputSystem/IMixedRealityInputSystem.cs b/XRTK-Core/Packages/com.xrtk.core/Interfaces/InputSystem/IMixedRealityInputSystem.cs index 9c50494f3..a823aa777 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Interfaces/InputSystem/IMixedRealityInputSystem.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Interfaces/InputSystem/IMixedRealityInputSystem.cs @@ -7,6 +7,7 @@ using XRTK.Definitions.Devices; using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; +using XRTK.EventDatum.Input; using XRTK.Interfaces.Providers.Controllers; using XRTK.Interfaces.Events; @@ -122,6 +123,15 @@ public interface IMixedRealityInputSystem : IMixedRealityEventSystem #region Input Events + /// + /// Raised when an input event is triggered. + /// + /// + /// WARNING: This event should not be subscribed to by MonoBehaviours! + /// Use the InputHandler interfaces instead. + /// + event Action OnInputEvent; + #region Input Source Events /// diff --git a/XRTK-Core/Packages/com.xrtk.core/Services/InputSystem/MixedRealityInputSystem.cs b/XRTK-Core/Packages/com.xrtk.core/Services/InputSystem/MixedRealityInputSystem.cs index 59faf772e..b790a8984 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Services/InputSystem/MixedRealityInputSystem.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Services/InputSystem/MixedRealityInputSystem.cs @@ -233,6 +233,11 @@ public override void HandleEvent(BaseEventData eventData, ExecuteEvents.Event return; } + // Sent the event to any POCO classes that have subscribed for events. + // WARNING: This event should not be subscribed to by MonoBehaviours! + // Use the InputHandler interfaces instead. + OnInputEvent?.Invoke(baseInputEventData); + // Send the event to global listeners base.HandleEvent(eventData, eventHandler); @@ -476,7 +481,7 @@ public void ClearFallbackInputStack() /// public bool TryGetController(IMixedRealityInputSource inputSource, out IMixedRealityController controller) { - foreach (IMixedRealityController mixedRealityController in DetectedControllers) + foreach (var mixedRealityController in DetectedControllers) { if (inputSource.SourceId == mixedRealityController.InputSource.SourceId) { @@ -493,6 +498,9 @@ public bool TryGetController(IMixedRealityInputSource inputSource, out IMixedRea #region Input Events + /// + public event Action OnInputEvent; + #region Input Source Events ///