playMaker

Author Topic: How to Set Property of the Parent GameObject and Include Children? [solved]  (Read 2673 times)

createasaurus

  • Full Member
  • ***
  • Posts: 146
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!
« Last Edit: December 24, 2014, 04:37:26 PM by createasaurus »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: How to Set Property of the Parent GameObject and Include Children?
« Reply #1 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

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: How to Set Property of the Parent GameObject and Include Children?
« Reply #2 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.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: How to Set Property of the Parent GameObject and Include Children?
« Reply #3 on: December 24, 2014, 03:38:47 PM »
You could cycle through all the children gameObjects using the "Get next child" action

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: How to Set Property of the Parent GameObject and Include Children?
« Reply #4 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.
« Last Edit: December 24, 2014, 04:38:36 PM by createasaurus »

velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
@600 your action works beautifully.  Thanks for posting it!  Saved me a ton of time and headaches.