Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: pretender on August 31, 2012, 09:57:07 AM
-
Hi!
I am adding children to grid element by code. it seems that they are not sorted in sequence
checking/unchecking "sort" in the UIGrid gives different result but not in the sequence i have this list. i made the list public
so i can see what order elements are in the list. it seems alse that in both ways ("sort" checked or not) it does take into account
game object names that are added to the Grid element (elements beginning with "a" get displayed first...)
can i resolve this somehow, maybe using table instead of grid?
-
I had similar problem, look here. http://www.tasharen.com/forum/index.php?topic=1511.msg7812#msg7812 (http://www.tasharen.com/forum/index.php?topic=1511.msg7812#msg7812)
-
It would be extremely helpful to have the Grid (or a new component) provide a list interface (Add(), Remove(), RemoveAt(), Insert(), etc) and maintain order. I'm writing a lot of extra code to keep numbers in front of names as I add and remove items.
-
Hmm... useful suggestion, thanks.
-
Thanks for that link, made for interesting reading. This was a similiar situation I was having, duplicating a list of items in code. The order was unpredictable, as was reposition. On iPhone the contents were backwards.
As a 'quick' fix I resorted to sorting them manually myself just to be sure they would work across all platforms.
Unity seems to be particularly random at sorting created items any. You only have to do a GetComponentsInChildren search on a menu object and see the order stuff is sorted in. It makes for interesting peeking.
-
I'm writing a lot of extra code to keep numbers in front of names as I add and remove items.
I'm doing the exact same thing ;)
-
Hi!
So how guys you resolve this issue?
Currently i am writing numbers to maintain the order but it seems that it does not work well.
Any advice on this?
Thanks!
-
Numbers must be in the form of 0001 0002 etc, not 1 2 3, because string comparisons think 10 is lower than 2 (but 10 would be higher than 02).
-
I know this is an old thread, but did a solution ever get made? There are many instances that I would love to use the grid but the ordering is a problem. I would add numbers to each object in the grid, but the objects are being added throughout the game from different players over the network and the code is getting longer and more complex than it needs to be.
-
I suggest just write your own grid component if you need to control the order in which objects appear, and not using UIGrid.