Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed "MissingReferenceException" errors when closing an in-game dropdown field [ISXB-1081](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1081).
- Fixed potential crash on Mac when using stale references to deleted InputDevice objects [ISXB-606](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-606).
- Fixed conditional compilation for non-editor analytics on platforms not enabling analytics.
- Fixed simulated touch input not working with PlayerInput component [ISXB-483](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-483).

### Changed
- Renamed editor Resources directories to PackageResources to fix package validation warnings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Users;
using UnityEngine.InputSystem.Utilities;
#if UNITY_EDITOR
using UnityEditor;
Expand Down Expand Up @@ -129,9 +130,6 @@ private unsafe void OnEvent(InputEventPtr eventPtr, InputDevice device)
if (eventType != StateEvent.Type && eventType != DeltaStateEvent.Type)
return;

////TODO: this can be simplified if we use events instead of InputState.Change() but doing so requires work on buffering events while processing; also
//// needs extra handling to not lag into the next frame

////REVIEW: should we have specialized paths for MouseState and PenState here? (probably can only use for StateEvents)

Pointer pointer = m_Pointers[pointerIndex];
Expand Down Expand Up @@ -332,9 +330,17 @@ private unsafe void UpdateTouch(int touchIndex, int pointerIndex, TouchPhase pha
}
}

if (touch.isPrimaryTouch)
InputState.Change(simulatedTouchscreen.primaryTouch, touch, eventPtr: eventPtr);
InputState.Change(simulatedTouchscreen.touches[touchIndex], touch, eventPtr: eventPtr);
//NOTE: Processing these events still happen in the current frame.
using (StateEvent.From(simulatedTouchscreen, out var touchscreenEventPtr))
{
if (touch.isPrimaryTouch)
{
simulatedTouchscreen.primaryTouch.WriteValueIntoEvent(touch, touchscreenEventPtr);
InputSystem.QueueEvent(touchscreenEventPtr);
}
simulatedTouchscreen.touches[touchIndex].WriteValueIntoEvent(touch, touchscreenEventPtr);
InputSystem.QueueEvent(touchscreenEventPtr);
}

if (phase.IsEndedOrCanceled())
{
Expand All @@ -356,6 +362,7 @@ private unsafe void UpdateTouch(int touchIndex, int pointerIndex, TouchPhase pha
[NonSerialized] private Action<InputEventPtr, InputDevice> m_OnEvent;

internal static TouchSimulation s_Instance;
private PlayerInput m_PlayerInput;

#if UNITY_EDITOR
static TouchSimulation()
Expand Down