playMaker

Author Topic: "Fsm not initialized" when accessing actions on a state in-editor  (Read 497 times)

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
    • View Profile
"Fsm not initialized" when accessing actions on a state in-editor
« on: September 06, 2018, 10:37:30 AM »
I'm trying to run a few checks on our FSMs from an editor window – this is just an editor tool, nothing that's going to execute at runtime.

The code is as follows (objectToFind is just the object we're looking at):
Code: [Select]
// get all the FSMs in this prefab
var allFsms = objectToFind.GetComponentsInChildren<PlayMakerFSM>();
if(0 < allFsms.Length) {
    foreach(var fsm in allFsms) {
        // get all the states in this fsm
        var states = fsm.FsmStates;
        foreach(var state in states) {
            // get all the actions in this state
            var actions = state.Actions;
            foreach(var action in actions) {
                // check stuff
            }
        }
    }
}

However, I keep getting the following error at the "var actions = state.Actions;" line:
Code: [Select]
get_actions: Fsm not initialized: State 1
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmState:get_Actions() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:731)

...along with "get_fsm: Fsm not initialized: State 1" and "Error Loading Action: State 1" and others. I've tried this where objectToFind is a prefab selected from the Project window, and also an instance selected from the Hierarchy window; both have had the same effect.

PaulBrinkkemper

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Re: "Fsm not initialized" when accessing actions on a state in-editor
« Reply #1 on: May 30, 2019, 02:35:58 AM »
Hey Nick, I have exactly the same problem;
I need to access al lot of my custom actions in Editor time, to run a translation gathering tool. However, the state actions are not initialised and cannot be found in editor time. Did you find a way around this?

nickfourtimes

  • Playmaker Newbie
  • *
  • Posts: 27
    • View Profile
Re: "Fsm not initialized" when accessing actions on a state in-editor
« Reply #2 on: May 30, 2019, 08:08:46 AM »
Unfortunately no solution on our end, what we ended up doing was "don't do this check unless a bug crops up and then do it manually."