Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: createasaurus on December 24, 2014, 08:35:48 AM

Title: How to Set Property of the Parent GameObject and Include Children? [solved]
Post by: createasaurus on December 24, 2014, 08:35:48 AM
I have a Game Object with lots of children.  I would like to switch the layer of all of these.  I'm using Set Property: Property: Layer - then inputting a layer number.  I am doing this for each child individually.  I fear when my project grows, doing it this way will be increasingly difficult to keep track of.

Is there a way to simply Set Property of the Parent GameObject and Include Children?

Thank you very much!
Title: Re: How to Set Property of the Parent GameObject and Include Children?
Post by: 600 on December 24, 2014, 09:52:42 AM
Hi, I'm using this to change layers for gameObject with children:

http://hutonggames.com/playmakerforum/index.php?topic=982.msg4060#msg4060
Title: Re: How to Set Property of the Parent GameObject and Include Children?
Post by: wheretheidivides on December 24, 2014, 01:51:25 PM
Some actions have a 'recursive' option to set the children as well. 'Activate' game object is one of them.  But these are actions set up to do stuff. 

The 'get property' and 'set property' don't.  Use them when no actions have been made to do what you want or when you need a high level of detail.

Of course, you or someone else could make up an action to do what you want as well.
Title: Re: How to Set Property of the Parent GameObject and Include Children?
Post by: escpodgames on December 24, 2014, 03:38:47 PM
You could cycle through all the children gameObjects using the "Get next child" action
Title: Re: How to Set Property of the Parent GameObject and Include Children?
Post by: createasaurus on December 24, 2014, 04:36:56 PM
@600
Thank you so much!  This action does Exactly what I needed.

@wheretheidivides
Thanks for the tips!  I'm just starting using get and set property - and realizing that children are not included with these.
Quote
Of course, you or someone else could make up an action to do what you want as well.
Good news is it looks like someone did, because I specifically need this for layers - per 600's post.

@LampRabit
Thank you.  I didn't know about "get next child" and will keep in mind for future needs.
Title: Re: How to Set Property of the Parent GameObject and Include Children? [solved]
Post by: velketor on June 17, 2018, 04:43:13 PM
@600 your action works beautifully.  Thanks for posting it!  Saved me a ton of time and headaches.