Search Unity

scrollview with many items can be painfully slow

Discussion in 'UGUI & TextMesh Pro' started by andyz, Dec 7, 2018.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    If I have a scrollable area with a long list of UI items then while static the fps is just fine (no vertex/mesh changes I guess), but as soon as you start scrolling the frame rate drops to single figures at least in windows editor (well low doubles without child masking, single with children that mask)

    This has probably been discussed before but can't the UI code just cull any object off screen or outside a scroll rect and draw very fast?

    I see there is the RectMask2D now which probably does exactly that and does help, but why not cull offscreen UI by default?
     
  2. bentontr

    bentontr

    Joined:
    Jun 9, 2017
    Posts:
    39
    I've also experienced really poor performance with the scrollviews. The single biggest performance gain I've found for them is disabling pixel perfect for the canvas that they live in. Otherwise you need to use a third party solution or create your own solution. Quite a shame really, but it doesn't seem like this will ever be addressed.
     
    marcowiprojects and andyz like this.
  3. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    Yes you are right, pixel perfect mode absolutely kills performance of a big scrolling list!
     
    marcel_z likes this.
  4. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    If the elements have the same layout, pooling does help a lot as well: https://github.com/Mukarillo/UnityDynamicScrollRect

    Other than that, ScrollRect2D helps a lot as you said, disabling all VerticalLayout groups and such after the first frame does help a lot as well.
     
    andyz likes this.
  5. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    To sum up.
    Pixel perfect is horribly slow - use a separate canvas for scrollable areas without if want in main UI
    Mask is slow - but there is RectMask2D, optimising the child elements being scrolled important though of course
    Custom code a scrolling-pool class for long lists of items in order not to create/draw loads of them if you want the very best! (e.g. https://github.com/Mukarillo/UnityDynamicScrollRect)
    Scrolling lists still update at fractions of a pixel as finish scrolling :-/

    Of course the fact that it is so easy to make a scrollable list UI that kills your FPS is disappointing but this will fix!
     
  6. Veanyth

    Veanyth

    Joined:
    Jul 3, 2018
    Posts:
    1
    I tried the scrolling-pool from (https://github.com/Mukarillo/UnityDynamicScrollRect), but I noticed that the scrollbar is not working as the content size off elements now is fixed to the viewport size because it's using the pooling system, so I was wondering if there is any solution to fix that.