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 = "";)