playMaker

Author Topic: Get Next Child Or Set Parent Not Working Properly  (Read 433 times)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Get Next Child Or Set Parent Not Working Properly
« 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
« Last Edit: October 15, 2018, 09:25:04 AM by krmko »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14334
  • Official Playmaker Support
    • View Profile
Re: Get Next Child Or Set Parent Not Working Properly
« Reply #1 on: October 16, 2018, 12:28:45 AM »
Hi,

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

 Bye,

 Jean

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Re: Get Next Child Or Set Parent Not Working Properly
« Reply #2 on: October 17, 2018, 06:12:42 AM »
Sure, i'll make a package and send it.

Cheers

terri

  • Sr. Member
  • ****
  • Posts: 373
    • View Profile
    • terrivellmann.tumblr.com
Re: Get Next Child Or Set Parent Not Working Properly
« Reply #3 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14334
  • Official Playmaker Support
    • View Profile
Re: Get Next Child Or Set Parent Not Working Properly
« Reply #4 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