Hello all,
Been playing with NGUI for the last two months and have gotten the hang of it pretty quickly. However, today I noticed an issue that I guess I just wasn't paying attention to before. It is as follows:
I have a list of items that need to be generated in my scene. Each of these items will have a corresponding Sprite in a clipped panel that will act as a 'This is the current item you are working on' GUI. I have changed my code to spawn these items based off of which Sprite is the centeredObject in the Panel (just matches up names and instantiates it, basically). My SpriteManagerScript instantiates everything perfectly and names all of the sprites according to the corresponding item in my itemList. Here is where the problem comes in... the ordering makes no sense to me.
I have my itemList set up this way:
- Element 0: Calculator
- Element 1: Ring
- Element 2: BinderClip
So, I want the player to use those objects in that exact order.
When they are instantiated and parented to the Grid, the children take up this order:
- 1: BinderClip
- 2: Calculator
- 3: Ring
Alphabetical order, obviously. I doubt this has much to do with the ordering and is more likely Unity just keeping things alphabetized.
However, when the grid is repositioned, the order is as follows:
- 1: Calculator
- 2: BinderClip
- 3: Ring
So this time around, it got the calculator part right, but skipped the Ring in order to put the BinderClip first.
Setting up my itemList like so:
- Element 0: Stapler
- Element 1: Ring
- Element 2: BinderClip
Results in an alphabetical child list, and so is the Repositioned order:
- 1: BinderClip
- 2: Ring
- 3: Stapler
So that time it ignored the stapler being first AND the ordering of the Ring and BinderClip.
Last but not least:
- Element 0: Ring
- Element 1: TapeDispenser
- Element 2: Battery
Results in:
- 1: Battery
- 2: TapeDispenser
- 3: Ring
Which throws a wrench in the previous alphabetical behavior.
Another kicker is that they were all being spawned at the same location, so I figured it must just not be able to figure it out because of their respective positions being the same. I changed it so that the sprites spawned a good deal of distance away from each other (this way they are in the proper order from left to right). The re-positioning of the grid ruins it. Any ideas?