Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Change mapping of mouse scroll-wheel direction to scrollbar?

Discussion in 'UGUI & TextMesh Pro' started by Velo222, Dec 28, 2014.

  1. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hello,

    I have a scrollbar and scroll-rect game object that I got working okay, and it's how I like it. However, when I scroll my mouse wheel over the scroll-panel area, the scrollbar moves down when I mouse-scroll upwards, and moves up when I mouse-scroll downwards.

    So for instance, on this forum page, if I scroll my mouse wheel up, the page moves up. This is the opposite of what my uGUI scrollbar is doing.

    So, my question is, is there a way to reverse how my mouse-scroll wheel affects the scrollbar using the new GUI system?

    I don't know if I should change it in the main "input" areas in Unity itself, because that could affect other areas of my game as well. But maybe I'll try that too.

    Thanks for any help.
     
  2. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Of course, as soon as I posted this, I figured out a way to get it how I want, but that's good :)

    So, previously I had my scroll-rect gameobject rotated by 180 degrees to make the content of the scroll view move the direction I wanted it too. As it turns out, I had to undo that (i.e. set the scroll-rect gameobject rotation back to "0" degrees).

    Then in the Scrollbar object itself (on the scrollbar script) change the "Direction" setting to "Bottom to Top". I knew about the direction setting before, and played with all of the options, but for some reason didn't quite get it right before this.

    Okay, so it looks like all is well, and I'm glad at least there is a way to get what I want! Thanks Unity team for making a new UI system. Having an integrated system that doesn't kill performance is really ideal.


    Two suggestions for the Unity UI dev team though:

    1. Have a button (or check mark option) where people can simply choose to reverse (i.e. invert) the mouse scroll wheel mapping to the scrollbar itself (and that only affects the scrollbar areas or only the UI).

    2. Allow an option on images to simply make them transparent (with no color). That is to say, some of us don't want images associated with our scroll areas. Currently there's no easy way to choose to NOT have an image associated with the scrollbar area. This is because if I want to use a mask on my scroll-rect game-object, it looks like I'm forced to use an image script along with it. Disabling the image script is not an option because it hides all the content I have in my scroll area as well. And the automatic color that comes with the image script as well, forces me to mess with the alpha of the color in order to make it transparent. But I can't make it fully transparent as this also hides the content of my scroll area too!

    Anyways, just nit-picking.

    Cheers!
     
  3. GoldenretriverYT

    GoldenretriverYT

    Joined:
    May 8, 2019
    Posts:
    13
    The easiest solution I came across was inverting the scroll sensitivity, works without changing anything else.