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

Question mouse wheel on scrollViews very slow with Unity 2021.1.x

Discussion in 'UI Toolkit' started by manuelgoellnitz, May 18, 2021.

  1. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    365
    I updated our project from Unity 2020.3. to Unity 2021.1.
    Here I changed the eventhandling from UIToolkits own EventSystem to the standard one.

    Then I discovered that scrolling in ScrollViews with the mouse wheel is much slower then it was before.
    In UGUIs ScrollRect there is the Paramater "Scroll Sensitivity" with which that can be changed there.
    But is there a way to do that for UIToolkits ScrollView as well?
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    733
    Hi, you can adjust the "vertical page size" property of the ScrollView (higher values will scroll faster).
     
  3. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    365
    That does the trick, thx
     
  4. Issus94

    Issus94

    Joined:
    Nov 22, 2021
    Posts:
    6
    I have the same Problem, i only can scroll very slow in the ScrollView from UIToolkit. Sadly for me the scroll sensitifity is not changeing when i take a higher value (for example 50) at Vertical Page Size. Does someone know why? Did anything change in an Update?
     
    RunninglVlan likes this.
  5. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    754
    There doesn’t seems to be a consensus on this. There is a supposed solution but it doesn't work for everyone. I reported the bug.

    https://forum.unity.com/threads/listview-mousewheel-scrolling-speed.1167404/#post-7934452

    https://issuetracker.unity3d.com/is...scroll-view-scrolling-when-entering-play-mode
     
    Issus94 likes this.
  6. Issus94

    Issus94

    Joined:
    Nov 22, 2021
    Posts:
    6
    thx for the reply. I directly voted for report. Hope there is soon a solution
     
    MousePods likes this.
  7. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    I tried changing vertical-page-size and it did no effect on scrolling speed whatsoever for me too.
    I want to match the scrolling speed to ScrollRect's ScrollSensitivity.
    And what does it even mean - verticalPageSize? Why not just verticalScrollSensitivity?
    Using Unity v2022.1.0f1
     
  8. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    3 months have passed already, changing
    vertical-page-size
    still doesn't work.
    --unity-metrics-single_line-height
    isn't read too (at least in our project). Link to issue tracker doesn't work anymore too.
    Now using Unity v2022.1.13f1
     
  9. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    754
  10. paxron

    paxron

    Joined:
    Aug 22, 2014
    Posts:
    8
    Can conform the issues in 2022.2.0b13
     
  11. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    Waited for this fix for too long. Using reflection as a temporary solution:
    Code (CSharp):
    1. const float scrollSpeed = 64;
    2. var utility = typeof(ScrollView).Assembly.GetType(
    3.     $"{nameof(UnityEngine)}.{nameof(UnityEngine.UIElements)}.UIElementsUtility");
    4. var lineHeight = utility.GetField("singleLineHeight", BindingFlags.Static | BindingFlags.NonPublic);
    5. lineHeight!.SetValue(null, scrollSpeed);
     
    MousePods likes this.
  12. Neutron

    Neutron

    Joined:
    Apr 25, 2011
    Posts:
    45
    I find that to affect the scroll rate you have to set the page size to something 1000+. The side effect of this is that when you press the buttons at the end of the scroll track, the scroll position jumps by a huge amount. Scroll wheel rate should not be connected to how much the end buttons move the dragger.
     
    fxlange likes this.
  13. unity_483C4357D3269025FA3B

    unity_483C4357D3269025FA3B

    Joined:
    Jul 2, 2022
    Posts:
    20
    @RunninglVlan, I am having the same issue, any chance you can explain in a few words how to use your fix?
     
  14. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    Just add it to MonoBehaviour's Awake. The code just changes internal field (through Reflection) that is used in scroll speed logic.
     
  15. SeanBannister

    SeanBannister

    Joined:
    Jul 13, 2020
    Posts:
    21
    For anyone else still running into this problem check out the response here it appears to occur when you enable/disable an EventSystem in the project.
     
  16. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    MousePods likes this.
  17. SeanBannister

    SeanBannister

    Joined:
    Jul 13, 2020
    Posts:
    21
    I reported it again and received an email "Your bug report ScrollView scroll speed decreases when an EventSystem is added to a scene has been confirmed and transferred to the appropriate internal development team at Unity."
     
  18. SeanBannister

    SeanBannister

    Joined:
    Jul 13, 2020
    Posts:
    21
    Had a response from Unity:

    Unfortunately, there is not much we can do about this, as we have a dependency there. We recently opened the ScrollView API to give control over the scrolling speed, so that users can adjust it based on their project's specific conditions. The attribute is `mouse-wheel-scroll-size`, or `mouseWheelScrollSize` from code (see https://docs.unity3d.com/ScriptReference/UIElements.ScrollView-mouseWheelScrollSize.html). This was added as an easier way to set the line height, that was previously supported with `--unity-metrics-single_line-height` in uss. Alternatively, if there is no use for the EventSystem with UI Toolkit (when not using UGUI at the same time as UITK), there is a way to manually disable interoperability with: `EventSystem.SetUITookitEventSystemOverride(null, false, false)`
     
  19. Allan_RD3

    Allan_RD3

    Joined:
    Oct 25, 2021
    Posts:
    4
    Is using the scrollers the only way to scroll in UI Builder scroll view? Why can't I scroll on mouse click like in the older UI scroll view? Is there a way to enable this behavior?
    upload_2023-6-15_17-14-42.png
     
  20. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    179
    BTW, scroll speed is slow again in latest beta and alpha versions =D IIRC, this thread is about it being slow only in UITK, but it's slow in these versions everywhere =)