Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: krmko on October 15, 2018, 08:28:56 AM

Title: Get Next Child Or Set Parent Not Working Properly
Post by: krmko on October 15, 2018, 08:28:56 AM
I've got a simple FSM consisting of:

1. Get next child, store it under 'child'.
2. Set parent of 'child' to none.

Repeat until all children are detached.

But, of 7 objects i have childred, not all are being detached. Any ideas? Seems like a bug.

Good old dumb find child/set parent to none works, this somehow fails.

Unity 2018.3b5
Title: Re: Get Next Child Or Set Parent Not Working Properly
Post by: jeanfabre on October 16, 2018, 12:28:45 AM
Hi,

 can you share the fsm in question, I'll try to repro.

 Bye,

 Jean
Title: Re: Get Next Child Or Set Parent Not Working Properly
Post by: krmko on October 17, 2018, 06:12:42 AM
Sure, i'll make a package and send it.

Cheers
Title: Re: Get Next Child Or Set Parent Not Working Properly
Post by: terri on October 17, 2018, 06:08:04 PM
I can reproduce, I assume when you unparent the child it messes with the index so when it loops back to get next child it ends up skipping some

Workaround can be to add them all to an array list and then unparent from that
Title: Re: Get Next Child Or Set Parent Not Working Properly
Post by: jeanfabre on October 17, 2018, 11:03:14 PM
Hi,

 ah yes... if you are looping through the childs, but during the loop you unparent the child, then it messes up the iteration for sure...

Bye,

 Jean