Scrolling using mouse wheel is not working in latest unity 2022.2.0f1

Tested ScrollView, ListView, MultiColumnListView, MulticolumnTreeView in 2022.1.24 and scroll using mouse wheel is working as expected.

It does not work in 2022.2.0f1. Did something changed in how scrolling work and there is a new setting somewhere (didn’t find anything in release notes)?

Thanks.

1 Like

After digging a bit more, it might be WheelEvent’s problem. Using event debugger I’m getting following in 2022.2.0f1:

Here is same event in 2022.1.24f1:

Any advise, workaround?

1 Like

I experience the same problem. Any feedback from Unity when this will get fixed?

Bug report: IN-25997

1 Like

Is there a timeline on a fix for this? I can’t see that jira ticket linked above.
2022.2.2 does not fix it.

Weird: after upgrading my project from 2021 to 2022.2, I’m just not getting WheelEvents at all (even the event debugger doesn’t show any, but all other mouse events seem to work fine). But mousewheel scrolling does appear to work fine if I create a new empty project…

EDIT: My bad: WheelEvents ARE being fired, they just weren’t selected by default in the event debugger so I missed them. But as above, Mouse delta is always (0, 0, 0):

Additionally, my empty test project was accidentally created with Unity 2021.x, after creating a new one with 2022.2 I see the same behavior in a new empty project, as well :frowning:

While looking for a workaround, I found that mouse wheel information isn’t completely broken in 2022:

element.RegisterCallback<WheelEvent>((evt) => {
    Debug.LogFormat("WheelEvent.delta: {0}, mouseDelta: {1}, Input.GetAxis: {2}",
                    evt.delta, evt.mouseDelta, Input.GetAxis("Mouse ScrollWheel"));
}

In 2021.x, the output shows that delta.y == mouseDelta.y:
WheelEvent.delta: (0.00, 3.00, 0.00), mouseDelta: (0.00, 3.00), Input.GetAxis: -1

In 2022.2, delta.y is always 0, but mouseDelta.y == Input.GetAxis("Mouse ScrollWheel"):
WheelEvent.delta: (0.00, 0.00, 0.00), mouseDelta: (0.00, 1.00), Input.GetAxis: 1

Also a little interesting: with mice that allow left/right inputs on the wheel, this does NOT appear to trigger a WheelEvent in Unity 2021.x, but in 2022.2 it does fire with a non-zero value in mouseDelta.x (both delta and Input.GetAxis were zero).

In our custom elements which relied on mouse wheel input, we had previously been using WheelEvent.delta.y, but it seems we can safely change this to mouseDelta.y (although the magnitude is different so we’ve got to adjust our sensitivity settings).

It’s not clear to me whether this is an expected breaking change and everything (including Unity-provided UIElements like the ScrollView) should switch over to using mouseDelta (according to the official documentation it seems we should still expect delta to be the way to go), but this also means that it’s possible to implement a (hacky) workaround for the time being (but if in a future release ScrollView starts to scroll on its own again, I fully expect this to cause problems):

            listView = root.Q<ListView>("ListView");
            var sv = listView.Q<ScrollView>();
            sv.RegisterCallback<WheelEvent>((evt) =>
            {
                sv.scrollOffset -= evt.mouseDelta * 10f;
            });

I got a reply saying that bug was fixed: Unity Issue Tracker - [2022.2] Scrolling is not working when using UI Toolkit ScrollView

Excellent. It remains to find out how to download version 2022.2.3f1 :slight_smile:

So, 2022.2.3 is out and you can install it via Hub. The scroll issue is fixed, BUT it now scrolls in the opposite direction as before. In 2022.1.x it scrolls down, now it scrolls up.

Is it intentional? Is there an option for UI Toolkit to invert scroll direction?

Thanks.

2 Likes

Came here to report the same point_up

I can’t find an option to invert the scroll direction.

1 Like

I dunno, I’m using 2022.3.3f1 LTS and it is not scrolling for me using the mouse wheel, at all. :frowning:

Is Input.mouseScrollDelta working for you?
The code I was using stopped working after upgrading from 2020.3 to 2022.3.4f1. I tried this mouseScrollDelta but I see no change. Even Input.GetAxis(“Mouse X”) or “Mouse Y” is broken here, same code works with 2020.3 but not 2022.3.

I tested it with this code:

void Update()
    {
        Debug.Log("Mouse X: " + Input.GetAxis("Mouse X").ToString() + " Mouse Y: " + Input.GetAxis("Mouse Y").ToString() + " Mouse Scrollwheel: " + Input.GetAxis("Mouse ScrollWheel") + " Mouse mouseScrollDelta: " + Input.mouseScrollDelta.y);
    }

Result (attached image)

Same results in a new project. When I move the mouse very fast some values are shown but they go back to zero the next frame.

9135487--1268662--mouse.png

We get the same thing in 2022.3.19.

1 Like

Just tested 2022.3.22f1 and cannot repro the same issue. Might be worth submitting a new bug with your specific repro.

All of our users are reporting mouse wheel DOWN does not work on mobile in 2023.2.18f1. When we reverted back to 2022.3 it worked again.

Have you tried using the Input System package and setting active input handling to “Input System (new)”? Input Manager is considered legacy nowadays, are most bugs should be fixed by switching to the new Input solution.

If you find that this also doesn’t work with the new Input, then you can submit a bug report and it will most likely get fixed by the Input team with a higher priority. Migrating existing code is supposed to be relatively straightforward; if it’s not, I’m sure they’d like to know about it because that’s the direction Unity is going in the future.

I hope this helps!