Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jess84 on May 27, 2014, 08:40:18 AM

Title: Get Child Number?
Post by: jess84 on May 27, 2014, 08:40:18 AM
Hi,

On each of my child objects, I want to be able to find out what number that child is of its parent and store it as an Int.

E.g. I have

/Buttons
    Button_001   (I want to know this is child 01)
    Button_002   (I want to know this is child 02)

etc.

None of the Child actions seem to be able to do this?

(I can't just use Get Name, as I have tutorial levels interspersed among the main levels, so the end of the button naming isn't consisten)

Title: Re: Get Child Number?
Post by: redikann on May 27, 2014, 10:37:32 PM
Well you can make it line up how you want by naming your children something like
0_Button
1_Button
as children start at 0 and go thru the list if you name your children with a preceding number they will have no choice but to fall in line.
get Child Num action seems to be what you want.
Title: Re: Get Child Number?
Post by: Lane on May 28, 2014, 07:28:26 AM
When you place objects in the hierarchy Unity organizes that kind of data different. I'm not really sure how the technical stuff works but basically if you have 8 boxes as children they're organized on the backend by age (essentially), so it would sort them by age spent as children of that parent in this action while you see them listed by name in the hierarchy. However if you take them out of the parented hierarchy after you name them correctly, then put them back in it will reorganize them and they'll line up right until you mess with the naming again.

Weird behavior, but maybe they patched it in the 1000 something bugs they fixes in 4.5.