Detect horizontal trackpad scroll
We are using Rewired's player.GetAnyButtonDown() method to check for controller input which will hide the mouse cursor. Unfortunately if a player is using a laptop touchpad and accidentally brushes a second finger against the trackpad, the horizontal "scrolling" motion is being detected as a Left Arrow or Right Arrow button press, which hides the cursor. Rewired's tech support is adamant that its not a bug in their system, and that the only alternative is to manually check each controller input for a button press, except for Left/Right. Yes, this fixes the issue but, of course, using Left/Right buttons will no longer initiate our "controller mode" and parts of our game menus have a grid layout where a player should be allowed to use left and right button inputs to begin navigating it.
I have tried both using Input.mouseScrollDelta and
private void OnGUI()
{
if (Event.current.type == EventType.ScrollWheel)
{
_trackpadScroll = Event.current.delta;
Debug.Log("Event scroll: " + _trackpadScroll);
} else _trackpadScroll = Vector.zero;
}
to detect when the Left/Right input received is coming specifically from the trackpad scroll, however the Unity Input system does not detect trackpad scrolling as mouse scrolling ( mouseScrollDelta remains (0,0)) and although the Event system does detect vertical trackpad scrolling as "ScrollWheel" input, it does not do the same for horizontal scrolling (the log above is not printed).
Am I missing some setting or a way to detect the input? This occurs on both Mac and Windows laptops. We are using Unity 2018.3.10.
Your answer
Follow this Question
Related Questions
Moving Unity DualTouchControls/Joystick on touch but also functioning on initial touch. 0 Answers
Input Field not scrolling Unity 5.4 0 Answers
How to differ between a mousedown over the map and a click on a GUI-Button 1 Answer
How to direct scroll input to ScrollView? 0 Answers
Invert UI scrolling 1 Answer