Fixed (1.20.0.4) Extremely slow UIDynamicPopup with lots of values

Acid Bubbles

Invaluable member
Developer
Featured Contributor
Messages
1,363
Reactions
5,469
Points
173
Website
github.com
Twitter
acidbubblesanon
Patreon
acidbubbles
When the amount of choices is high, loading and opening the list is very slow. For 2000 items, it takes 4.5s to create the drop down on my machine. This is coming from scenes people have sent me so I'm guessing this is not abnormal. The typical case is the geometry storable, which contains all animatable morphs, but I also had to work around this for the collider editor plugin.
 
It is issue with Unity UI that I can't easily solve. My solution in 1.X is going to be to add a filter to limit what is shown in the popup.

For 2.X the solution is going to be better param organization and naming, tags, filter, and search mechanisms.
 
The issue is that VaM does create all the 2000 UI items before hand, although can't seem them all at once anyway. For a UI of that size you would need some logic that keeps reusing the same few buttons inside the ScrollView while you scroll down the list.
 
Yeah I'm a bit mad Unity didn't build this in. It is an obvious feature. But having 2000 items to scroll through is also useless and that is on me. :) I should have not put so many storables/params on "geometry". When I did it, triggers were not a thing. So now I need to retrofit a solution (filter) or have a different type of UI browse instead of just a dropbox. I can't reorganize 1.X storables/params without breaking a lot of things. 2.X gives me an opportunity to have better param organization from the start.
 
Well, I don't think having 2000 animatable morphs is what users wanted in the first place, I know some people work hard but that's a bit much :) I feel that there might be a reason why it's so slow though, but I cannot really dig more. It's probably not a huge priority anyway, though it did happen often enough to warrant a post.
 
It is slow because Unity renders the entire 2000+ UI elements into a UI panel and then masks off just the amount you see. It might not actually do a full render but it has to consider all 2000 and determine if they are in the masked area.

The text scroll areas have the same issue which is why I have log panels limited in size. And if you have too many files in one folder you will also hit this. It is basically an issue with Unity's ScrollRect implementation. @MacGruber was right that this could be worked around by creating a UI element that presents a faked out scroll view, which only has limited number of elements in it. But this might require a lot of time to implement, and time is something I'm very short on.

What I can do in 1.X is limit the number of elements that can be shown in the popup and use some kind of filtering or paging system.
 
Back
Top Bottom