Unity3d: delayed loading of scrollview content

Source: Internet
Author: User

Problem description: a large amount of data is loaded in a scrollview, including text, images, and videos. The first loading will be very slow and slow, and the memory usage will be high after loading.
Solution 1:
Think: fix an area. When an object rolls to this area, it loads the data carried by the object. When the object leaves this area, it releases the data carried by the object.
Row: When doing this, the first thing that comes to mind is to calculate the coordinates of the current object. When the coordinates of the object arrive within the coordinate range of the fixed area, they are loaded and released when they leave the region range, because the objects are in the scroll bar, the coordinates remain unchanged. The final solution is to add a widget to the current object and determine whether the widget is active. When the widget appears within our visible range, the system obtains that its active status is true, when he leaves our visible range, his active state is false. Here, when looking at the results, each time the result is dragged and dragged to the scroview object to scroll, it still feels like a card, because it is determined that the loaded data is in the update method, all objects will go through. The solution is to check the cull attribute in the uipanel with scrollview, which means that only the objects in the current display area can be updated.
PS: when the content is released from the visible range, set the data carried by the object to null and call resources. unloadunusedassets ();. (For texture, set maintexture = NULL; for label, set text = "";)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.