playMaker

Author Topic: Get Child Num indexing?  (Read 2313 times)

kyoung

  • Playmaker Newbie
  • *
  • Posts: 3
Get Child Num indexing?
« on: November 08, 2013, 06:39:38 PM »
Hi! I was just wondering how the indexing works when using Get Child Num. I'm currently using a system that adds an int, then gets that index of child, but it doesn't appear to down the list of children in the order I've got them in the hierarchy (which, incidentally, is alphabetical order). For instance, my hierarchy looks like this:

>Parent
  >Child01
  >Child02
  >Child03
  >Child04
      etc.

When I use the Get Child Num, first it gets the Child01, then after that it adds 1 to the index int, but instead of getting Child02, it gets Child07 and then Child08, and seems to jump around randomly. Is there any way to enforce the order in which the children are indexed? I would like it to go down my list of children in the order I've got them in the hierarchy. Thanks!

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: Get Child Num indexing?
« Reply #1 on: November 09, 2013, 06:57:10 AM »
You will have to use array maker for this. Arrange your array list and use get next action and you will loop through that list taking one by one child in alphabetical order.
Did you tried this already or?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Child Num indexing?
« Reply #2 on: November 11, 2013, 01:40:15 AM »
Hi,

 indeed, no guarantee:

http://answers.unity3d.com/questions/276230/iterating-through-children-of-transform-is-there-a.html

Bjakuja is right, I would also go via an arrayMaker sorting first.

BUT, that's only if you really need to get them in order. Are you sure you need to processed them alphabetically? could you explain the reasons ( might make perfect sense, jsut want to double check with you that you indeed need to go trhough all this in the first place).

bye,

 Jean