[SOLVED] How to get Scroll Wheel Data?

Dear All

How can i correctly get the mouse wheel input?

In this case the Vector2 is always (0,0).

Screenshots:

        public void OnZoom(InputAction.CallbackContext context)
        {
            Vector2 wheelInput = context.ReadValue<Vector2>();

            if (wheelInput != Vector2.zero)
            {
                Debug.Break();
            }

            //Debug.Log("OnZoom Callback with float: " + wheelDelta.ToString());

            throw new System.NotImplementedException();
        }

The “scroll” control is already a Vector2. Remove the Vector2 composite and bind to the scroll control directly.

1 Like

Thank you, did work just fine!

Would be really great if you guys could provide an example how to setup scrolling in the new system. I have to say being a new user trying to understand what is going on through this transition to the new system is extremely painful, confusing, and a massive waste of time.
Plenty of demos online for the old system which is clearly less robust - but quite frankly WAY more logical for a newb to get into… simply hard code a key and start writing an action…
Here we are setting up InputActions in a window, creating a C# script, binding it to an object, going to player control options to bind those to areas in our script… then start troubleshooting 3 possible links in the chain…All before we know… Is my action type right? is my control type right? do I want 1 axis, 2, or 3… if 3 how can I define it (I can’t in the tool)…

I searched the input system docs for scrollwheel… Also searches online (brought me here).

In the example above - throw us newbs a bone and write a complete answer even though you know the poster is more advanced. It helps us others lurk and learn
For example a step through…
For scrolling:
“Set the action to ___” with the following control types.
“Add a ___ binding” and set the bindings to scrollwheel x and y"…
Then you answer "Scroll is already a Vector2 as you can see set above in ___
etc etc

If that already exists in a previous post someplace… linking to the previous post in this post also helps until we all understand what this thing is doing and how you expect people to implement standard things like scrollwheels would be a good practice.

All of this would be wildly helpful until Brackeys, Dapper Dino and the others can hit the various use cases for the new system.

I do think the new system has massive potential which is why I want to start off by using it… but I also just want to get zoom working so I can create and move on to other things.

6 Likes