Support => NGUI 3 Support => Topic started by: doncarlos91 on May 20, 2016, 03:13:17 AM
Title: UIWrapContent with dynamic data
Post by: doncarlos91 on May 20, 2016, 03:13:17 AM
Hi all, i have a shop functionality with 100+ items , here is my structure
UIScrollView UIWrapContent Item Item Item etc. The problem is that , when i`m clicking on the category button , it displays the items in 2-3 seconds and then when it is loads - the UIWrapContent performance works perfectly.
Question - how can i prevent this heavy items loading and what is the best way to do this? Maybe the load prefabs partially , when user scrolls horizontally . Will be glad for you suggestions and useful code snippets as well.
Thanks in advance
Title: Re: UIWrapContent with dynamic data
Post by: ArenMook on May 21, 2016, 09:48:41 PM
UIWrapContent is used to recycle items. For example if you have 100 items, but only 10 are visible, you need to add 10+2=12 children at most, as they will be reused when they go out of range.
In the current game I'm developing I have a scroll view where I generate preview thumbnails for all the items within it which involves rendering them to render textures. I made it so that it only renders 1 item per frame rather than all of them at once. This makes items appear one at a time (and I can make them fade in if I want), but also means that there is no performance hit as I don't try to draw them all at once.