PlayMaker News > General Discussion
SetState Before FSM start
(1/1)
densy:
Hi,
Can I use the PlayMakerFSM.setState to change my default state before the FSM start?
After I do that, the PlaymakerFSM will call the PlaymakerFSM.Fsm.Start(), it will trigger the current state exit and enter again. So my target state will trigger twice.
To prevent this, my code is
--- Code: ---if (m_fsm.Fsm.Started == false) {
m_fsm.Fsm.Start ();
}
if (state != m_fsm.ActiveStateName) {
m_fsm.SetState (state);
}
--- End code ---
Is that right? It's my first time to use Playmaker. Thanks!
jeanfabre:
Hi,
no, you can't change the Start state programmatically.
Instead, make your state state an Empty state, and then you can control the fsm safely.
you might have to wait one frame for things to have time to inititalize.
Bye,
Jean
Navigation
[0] Message Index
Go to full version