Im using NGUI which in some of its components displays its items by the order of its children (UITable) I want to add a child into a specific location the list of children. Anyone think of a way to do this?
Only one I can come up with is to get a list of the children, null their parents and then add them back in the order I want. Not a great solution by any means.
Abomb’s solution should work, but UITable just sorts it’s children once at start and caches the references in an internal List< Transform >.
The Good news are that they provide the “children” property which returns the direct reference to that List, so you can sort it as you wish in code.
If you just want to order them at edit time, just use Abomb’s solution since NGUI doesn’t provide a GUI for changing the order.
edit
Unfortunately NGUI trashes it’s internal list whenever it repositions it’s elements. That means it sorts them again just by name. So unless you change the NGUI framework (which i wouldn’t recommend) the name is the only way to define an order.