When I am creating 300-400 child items(draggable items) in ui draggable panel (NGUI) I am getting the error ‘There are too many vertices in one panel’.
More over the draggable items lags a lot.
What is the best way to overcome this problem?
When I am creating 300-400 child items(draggable items) in ui draggable panel (NGUI) I am getting the error ‘There are too many vertices in one panel’.
More over the draggable items lags a lot.
What is the best way to overcome this problem?
I don’t know if this has been answered yet, but if you have outlines or shadows on labels, those increase the vertex count dramatically. Try setting the Effect to None.
I just ran into this problem myself, but with a very long UILabel that was being used for an output log (doing stuff just kept adding to the end of the label, making it bigger and bigger).
Aren says the limit on vertices in a panel is 64k, which is a huge amount. To reduce the amount of geometry, there are a few strategies (such as reducing the drawable content like label effects), but one interesting method springs to mind immediately, from iOS / UIKit. In UIKit, UITableView will re-use cells when you scroll through a much larger dataset. The class will automatically handle “paging” the data into and out of a small set of visible table cells that remain on the screen. When you scroll past a particular cell, the cell is just moved and re-used/repopulated with some other data item.
This way, the table view supports an endless amount of scrollable items contained with it, but with only a small amount of actual rendering that needs to happen to display those items (solving the “too many vertices” problem).
Adobe Flex and many other UI toolkits also implement this design, also known as the Flyweight pattern ( Flyweight pattern - Wikipedia ).
I don’t think NGUI has anything like this implemented (yet?), but it shouldn’t be too hard to create it yourself