Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cjke.7777

Pages: [1]
1
NGUI 3 Support / Re: (!!!) Improving NGUI: Voice your opinion
« on: April 13, 2014, 07:40:27 AM »
Great work on NGUI. I purchased it probably more than a yeah ago and never really got stuck in to it, but having picked it up again, I'm loving it.

I know you've mentioned improvements to UIGrid is coming, but I just want to voice my opinion - improvements on UIGrid would be great. Especially adding an anchor to it would be good.

2
NGUI 3 Support / Re: UITable sorting
« on: July 03, 2013, 06:23:26 AM »
I know I'm new (first post!) && this is an old post but... I arrived to this thread when trying to find the answer to the same problem, so I figured it best that I help others.

The reason this is happening (and it happens only when sorted is set to false) is in fact the lines above, but not at the fault of NGUI mind you.

These lines:
  1. Transform myTrans = transform;
  2. mChildren.Clear();
  3.  
  4. for (int i = 0; i < myTrans.childCount; ++i)
  5. {
  6.     Transform child = myTrans.GetChild(i);
  7.  
  8.     if (child && child.gameObject && (!hideInactive || NGUITools.GetActive(child.gameObject))) mChildren.Add(child);
  9. }
  10.  

It is well documented (by not being documented at all!) that there is no guarantee when iterating over a transform the order of the children it returns - despite what you see in the inspector panel (which is always alphabetical).

Google 'unity3d transform children order' and you will see that the order is not guaranteed, and in fact GetChild is no longer part of the documentation as Transform interfaces from IEnumerable and so should be foreach'ed instead. Even when using a foreach though, you have no guarantee of order (when not using NGUI's sorted flag).

Two suggestions - either preface your children's names with a consistent label (such as "btn_") or implement your own sorting algorithm if alphabetical is not what you want.



Pages: [1]