Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -55,6 +55,7 @@ however, it has to be formatted properly to pass verification tests.
- 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).
- Fixed unused PenState information to determine the displayIndex on platforms providing it. (PLAT-10123)

### Changed
- Renamed editor Resources directories to PackageResources to fix package validation warnings.
Expand Down
7 changes: 5 additions & 2 deletions Packages/com.unity.inputsystem/InputSystem/Devices/Pen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public struct PenState : IInputStateTypeInfo
[FieldOffset(32)]
public ushort buttons;

// Not currently used, but still needed in this struct for padding,
// as il2cpp does not implement FieldOffset.
/// <summary>
/// The index of the display that was touched.
/// </summary>
[InputControl(name = "displayIndex", displayName = "Display Index", layout = "Integer")]
[FieldOffset(34)]
ushort displayIndex;

Expand Down Expand Up @@ -379,6 +381,7 @@ protected override void FinishSetup()
inRange = GetChildControl<ButtonControl>("inRange");
tilt = GetChildControl<Vector2Control>("tilt");
twist = GetChildControl<AxisControl>("twist");
displayIndex = GetChildControl<IntegerControl>("displayIndex");
base.FinishSetup();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void OnPointerPerformed(InputAction.CallbackContext ctx)
m_SeenPenEvents = true;

var positionISX = ctx.ReadValue<Vector2>();
var targetDisplay = asPointerDevice != null ? asPointerDevice.displayIndex.ReadValue() : (asTouchscreenDevice != null ? asTouchscreenDevice.displayIndex.ReadValue() : 0);
var targetDisplay = asPointerDevice != null ? asPointerDevice.displayIndex.ReadValue() : (asTouchscreenDevice != null ? asTouchscreenDevice.displayIndex.ReadValue() : (asPenDevice != null ? asPenDevice.displayIndex.ReadValue() : 0));
var position = ScreenBottomLeftToPanelPosition(positionISX, targetDisplay);
var delta = pointerState.LastPositionValid ? position - pointerState.LastPosition : Vector2.zero;

Expand Down
Loading