- Home /
Using EZGUI can I Create large amounts of listObjects without lag
Using a ScrollList, I am currently creating and deleting large amounts of UIlistObjects on the fly. Each ListObject has 4 SpriteText children, whose text also updated upon creation.
The creation of a few, or even 100 listobjects, is done quickly, but when I reach numbers such as 300, or 500, there are large amounts of Lag. Also, while using UIListObjects, I realized that all children, of that listObject, would not be clipped correctly.
A Fix I tried : I tried putting the "create listObject", and "add listObject to UIList" code in an CoRoutine function, then after every 100 listObjects created, I called a "yield WaitForSeconds(.0001f)" This seemed to work, except still lags when values are extremely high, such as in the thousands.
To fix the clipping issue, I used UIListObjectContainers instead of UIListObject, however, when being created in a CoRoutine, the UIListObjectContainers jumble on top of one another.
Is these a way to create large amounts of UIListObjectContainers without lag? if Not, is there a way to create them via CoRoutine, with something like a yield WaitForSeconds(.0001f), and NOT jumble on top of each other?
Answer by robertbu · Feb 19, 2013 at 05:35 PM
You should edit your title to include EZGUI so folks who know EZGUI might be drawn to your question.
As for your lags, if you have pro, profile your app and see what is going on. A year ago I tackled a similar project using EZGUI. I found most of the performance hit was in the scroll list code for what I was doing (not in the item creation code). My solution was to write my own, much simpler scroll list. My simpler code did not have clipping, so I placed a texture on a plane in front with a transparent cutout. The performance improvement was huge. Display times went from seconds to tenths of seconds. I also deferred the destruction of game object, which also had a big impact.
What are the simple sprites displaying? Are they something dynamically loaded, or do they come from a set of images you know at compile time?
Thanks robertbu
Im sorry, I meant SpriteText, not SimpleSprites ( I will update the question accordingly ) The SpriteTexte are updated dynamically, its a bunch of double and float values,
However, I dont think its the changing of these values that cause much lag, when I adjust all of these values, without adding or removing ListObjects, or ListObjectContainers,- or add objects without changing any values, I get no Lag.
I am going to look into writing my own ScrollList, but that seems like a huge undertaking.
I just look at my scroll list code. It is around 350 code lines. Of that there is around 100 lines you would not need for your purpose.
But maybe you can work around your issues. I did a demo for a dynamic outline using EZGUI at one point. I don't remember exactly how it was done, but I reduce the line height to 0 for hidden items (may have turned off the renderer as well). $$anonymous$$aybe you can do something similar. That is populate the list with 500 items to start, but collapse all that you don't use. Then when want to add/subtract/change, reset all the sprite text starting with the first item to change and then call RepositionItems() on the scroll list.
Your answer

Follow this Question
Related Questions
Lag on Collision from Projectile 1 Answer
Big FPS drop when using SetHeights on terrain 2 Answers
Why does this script lag so much? 2 Answers
Low FPS with charachter animation 1 Answer
why my android game lag when getting data from online mysql 3 Answers