playMaker

Author Topic: Getting properties of children of a prefab.  (Read 1038 times)

Rush_Maverick

  • Playmaker Newbie
  • *
  • Posts: 2
Getting properties of children of a prefab.
« on: December 17, 2019, 06:03:35 AM »
Hey, I'm having trouble understanding how to go forward with this and I am not sure what information to post, so please ask me if there is anything you need to know.

But basically, I'm trying to check for true/false changes in children of a prefab that all exist at the same time and I do not know how to do it.

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Getting properties of children of a prefab.
« Reply #1 on: December 17, 2019, 07:10:14 AM »
OK so you can use a Get FSM Bool to get a copy of a bool from any object. If that target object is a child in a prefab, this is very straight forward. You specify it by directly dragging in the target object. Other more complicated methods would include using a variable object to specify the target to get the bool from.

The above is IF the target object is in the same prefab as the one trying to get to the bool.

However, if the one trying to get the copy of the bool is OUTSIDE the prefab, it's a different story.

Maybe you would have to rig up something like the external object sends an event to the prefab (identified via a collider, a raycast, or because it was ID'd when it was spawned), that prefab then knows it's child object to get the bool from, so collects the copy of the bool, then sends and event back to the original external object (which ID'd itself to the prefab at the same time it sent the event).

Or.... just put the FSM in the Prefab root object? That would cut it out of being the middle man. Unless there is a specific reason why the child object of the prefab has to contain the FSM.
« Last Edit: December 17, 2019, 07:16:23 AM by daniellogin »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Getting properties of children of a prefab.
« Reply #2 on: December 18, 2019, 12:02:42 AM »
Hi.
Just a side note, you could also use the 'Fsm Bool Test' (you can find this on the Ecosystem )
instead of Get Fsm Bool and Bool Test.