Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: nickfourtimes on September 06, 2018, 01:37:30 PM
-
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):
// 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:
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.
-
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?
-
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."