playMaker

Author Topic: Get child action for a variable GameObject?  (Read 733 times)

SawyerK

  • Junior Playmaker
  • **
  • Posts: 93
Get child action for a variable GameObject?
« on: August 16, 2020, 01:06:16 PM »
Hi!
I have an "engine_hinge" that holds the engine of the vehicle. This engine can be taken out and be swapped for another engine. Therefore the "engine_hinge" checks if it has a child and stores this child as an "engine" variable. My only problem with this, is that i have to swap and install the engine gameobject twice for the Get Next Child action to store the new gameobject variable.
Is there a better way to handle this? Because there are a lot of FSM's and variables that have to get this new child gameobject variable when its attached to the "engine_hinge".



 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get child action for a variable GameObject?
« Reply #1 on: August 16, 2020, 03:14:46 PM »
Hi.
When you start, have the current engine in the variable 'Current Engine'

To know if there is a engine stored, you can use 'Game Object Is Null'

When you Place a new engine store directly into the 'Current Engine' variable

SawyerK

  • Junior Playmaker
  • **
  • Posts: 93
Re: Get child action for a variable GameObject?
« Reply #2 on: August 16, 2020, 03:50:34 PM »
Thank you!