PlayMaker News > General Discussion

Generate fsm template by code ?

(1/1)

FXCarl:
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: --- 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);
}

--- End code ---

jeanfabre:
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

Navigation

[0] Message Index

Go to full version