playMaker

Author Topic: Generate fsm template by code ?  (Read 1880 times)

FXCarl

  • Playmaker Newbie
  • *
  • Posts: 4
Generate fsm template by code ?
« on: September 17, 2014, 02:07:04 PM »
if it possible, i can build a step by step game flow by text lines without drag and drop lots of icons  8)

i tried these codes, but it cann't work  :(

Code: [Select]
void Start () {
FsmTemplate fsmt = ScriptableObject.CreateInstance<FsmTemplate>();
Fsm fsm = new Fsm();
// Gen FSM
FsmState IdleState = new FsmState(fsm);
IdleState.Name = "IdleState";
fsm.StartState = "IdleState";
//
fsmt.fsm = fsm;
PlayMakerFSM fsmObj = gameObject.AddComponent<PlayMakerFSM>();
fsmObj.SetFsmTemplate(fsmt);
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Generate fsm template by code ?
« Reply #1 on: September 18, 2014, 09:44:02 AM »
Hi,

 never tried it, so you'll have to fiddle with it big time, you may find that not everything you need will be exposed in the PlayMaker api... so be careful with this.

 Bye,

 Jean