Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: HeathClose on August 15, 2017, 07:24:59 PM

Title: How to Kill Parent if Child Dies[SOLVED]
Post by: HeathClose on August 15, 2017, 07:24:59 PM
How can I destroy or deactivate a parent object (the empty holding the children) when a child is destroyed or deactivated?

I thought about a get child count and doing an int compare, but that action doesn't have every frame.
Title: Re: How to Kill Parent if Child Dies
Post by: jeanfabre on August 16, 2017, 03:00:36 AM
Hi,

 If you have PlayMaker Utils in your project, there is a component "TransformEventsBridge" which will listen to hierarchy changes on your GameObject, it allows you to fire an event, and so use this to check only when required how many child you have and take appropriate steps then.

I also created a new custom action on the Ecosystem GetChildCount2 which will expose an everyframe option, though, it's not optimal and I suggest you use the component above.

Let me know how it goes.

 Bye,

 Jean