I need to be able to detect horizontal scrolling on trackpads on MacOS. Input.getAxis("Mouse ScrollWheel")
detects the vertical axis, but there’s nothing built in (that I’m aware of) for the horizontal axis.
I created a plugin that attached an NSResponder to the main window and listened to some trackpad events. swipeWithEvent
is the one I care most about, but I also detected magnifyWithEvent
and rotateWithEvent
for the fun of it. I attached it with this code:
[[[NSApplication sharedApplication] mainWindow] setNextResponder:obj]
That worked, but only for the magnify and rotate events. It still can’t detect the swipes. I think the problem is that my object is lower on the responder chain and Unity needs to listen to swipeWithEvent for the “Mouse ScrollWheel” axis. So I tried this code after the previous line:
[[[NSApplication sharedApplication] mainWindow] makeFirstResponder:obj]
That didn’t change anything. Unity still gets swipes first, and it’s tossing out the horizontal axis scrolling as far as I know.
Is there anything I can do? I’d be perfectly okay with a solution where my plugin ends up taking over both axes and I have to rewrite the code that uses Input.getAxis("Mouse ScrollWheel")