Playmaker Forum
PlayMaker News => General Discussion => Topic started by: densy on March 23, 2018, 04:49:15 AM
-
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
if (m_fsm.Fsm.Started == false) {
m_fsm.Fsm.Start ();
}
if (state != m_fsm.ActiveStateName) {
m_fsm.SetState (state);
}
Is that right? It's my first time to use Playmaker. Thanks!
-
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