Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: turkeypotpie on January 10, 2013, 07:34:19 PM

Title: Attaching FSM behavior to GameObject
Post by: turkeypotpie on January 10, 2013, 07:34:19 PM
If I make a standard Monobehavior, I can attach it to whatever object I choose.

But if I make a behavior in a PlayMaker FSM, it's bound to the GameObject it was created on.  AFAIK, if I want to move the behavior to another type of GameObject (ie. in another prefab), I have to:

1.  Copy the component from one GameObject to another.
2.  Use templates to copy from one GameObject to another.
3.  Put my Fsm behavior in a separate prefab, and add that prefab as a child to each of my GameObjects.

Options #1 and #2 are more-or-less the same thing.  They are often bad practice because all the copying and pasting.

Option #3 works, but has some problems.  For one, it requires all states to be modified so they point to the relevant GameObject they modify.  In addition, not all state actions are relocatable.  For instance, all trigger and collision actions must be bound to their respective GameObjects.

Is there a better option that I'm missing?
Title: Re: Attaching FSM behavior to GameObject
Post by: jeanfabre on January 11, 2013, 02:07:02 AM
Hi,

 Coming up on the next release :) you will be able to assign a template to a PlayMaker Fsm, not a copy, but a reference to the template. It's working well.

bye,

 Jean
Title: Re: Attaching FSM behavior to GameObject
Post by: Lane on January 11, 2013, 07:57:54 AM
Hi,

 Coming up on the next release :) you will be able to assign a template to a PlayMaker Fsm, not a copy, but a reference to the template. It's working well.

bye,

 Jean

WOOOO!!  :D
Title: Re: Attaching FSM behavior to GameObject
Post by: turkeypotpie on January 11, 2013, 12:29:47 PM
Sounds like a good solution.  Be looking forward to it.