playMaker

Author Topic: Access FSM action from Assets Folders  (Read 1237 times)

madturtle84

  • Playmaker Newbie
  • *
  • Posts: 1
Access FSM action from Assets Folders
« on: January 18, 2016, 03:53:21 AM »
I was doing something like this:

Code: [Select]
PlaymakerFSM fsmComp = myPrefab.GetComponent<PlayMakerFSM>();

foreach (FsmState state in fsmComp.Fsm.States) {
  foreach (FsmStateAction action in state.Actions) {
    Log.Debug(action.Name);
    // Store some data from the action class
  }
}

Then I get error like
get_actions: Fsm not initialized:
get_fsm: Fsm not initialized:
Error Loading Action:

I soon found out that it is because I was accessing the FSM from a prefab in the Assets/Resources folder. If I could instantiate the object before running this code, there's no error (But I'm not allowed to do so).

However, the weirdest thing is, if I run the game with the Gamemaker Editor opened, the errors won't occur!

I wonder if this is a playmaker bug, or we're not suppose to access FSM actions from Assets folders at all.