Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Doh on April 20, 2017, 11:47:08 AM

Title: Finding a child during runtime
Post by: Doh on April 20, 2017, 11:47:08 AM
Hey, I'm finding it difficult to find a solution to this.

I have a game object that takes on different child objects during runtime, though only ever one at a time. My issue is getting an FSM to check for the child object once it takes on the new parent.

So far I've only been able to get it to check for a child on start, this results in a negative response obviously as the child is not there yet.

Any pointers would be greatly appreciated!
Title: Re: Finding a child during runtime
Post by: Doh on April 20, 2017, 11:56:32 AM
I've only just discovered global events... oops. I think this may be where I need to look.
Title: Re: Finding a child during runtime
Post by: MajorIdea on April 20, 2017, 04:40:45 PM
Not sure if I'm understanding the issue but you could perhaps use the Game Object Is Child Of or Get Child Count and update when that number changes.
Title: Re: Finding a child during runtime
Post by: Doh on April 20, 2017, 05:44:58 PM
I managed it using "get child num" and keep it checking by applying a one second wait which then loops back and starts that state again.

Is there a way to listen for the change rather than checking?
Title: Re: Finding a child during runtime
Post by: djaydino on April 21, 2017, 03:16:38 AM
Hi,
Maybe you can use an array to place your objects it and find them there,
that is better for performance.

if you are creating the child object you can store the object in a variable and then add to an array.