Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: paradoxjester on July 26, 2018, 04:34:19 AM
-
Hey everyone,
I'm creating some editor scripts in unity, and i was asked to set a PlayMakerFSM component's inner FSM value to be the instance of a FSM Template. This FSM Template is stored in a Scriptable Object, and when the Scriptable Object is assigned to the GameObject, then the FSM value of the PlayMakerFSM component should change. I don't want to set the PlayMakerFSM's template to be the FSM Template, i want the inner FSM to be a copy of the FSM Template. I can extract an instance from the template using the FsmTemplateControl class, but i don't know how to insert it in the component.
Can anyone help? I'd be very grateful ,:D
-
Hi,
you need to call <PlayMakerFSM>.SetFsmTemplate(templatePointer);
then that FSM will use the template.
I am not sure if I follow your sentence on :
"I don't want to set the PlayMakerFSM's template to be the FSM Template, i want the inner FSM to be a copy of the FSM Template"
Are you planning on modifying the fsm state and transition at runtime? if not, then a FsmTemplate reference will be fine.
Bye,
Jean
-
Hi,
Thank you for answering. This is not something i planned on doing at runtime, instead i'm doing this via editor. I want to copy the contents of a template (its states, transitions and events) into the FSM of a PlayMakerFSM component, but breaking off the reference to the original template, this way if the component's FSM is modified, it will not modify the original template's FSM. I have achieved this by copying all of the Template's states, events and transitions individually into the component's FSM. Everything seems to be working correctly!
Thank you again!