Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

scrollview with many items can be painfully slow

Discussion in 'Unity UI & TextMesh Pro' started by andyz, Dec 7, 2018 at 2:16 PM.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    916
    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:
    11
    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.
     
    andyz likes this.
  3. andyz

    andyz

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

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    535
    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. LurkingNinjaDev

    LurkingNinjaDev

    Joined:
    Jan 20, 2015
    Posts:
    1,756
  6. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    916
    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!