Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Martin on March 15, 2013, 02:23:59 PM
-
I'm writing a custom action and was looking for a way to check if a FSM has a variable, and if not to create it. Is that possible?
-
I have a similar question, but just for adding variables via script, so am bumping this.
-
Fsm variables can be found here:
FsmComponent.Fsm.Variables
Each variable type has its own array:
FsmComponent.Fsm.Variables.FloatVariables[]
FsmComponent.Fsm.Variables.IntVariables[]
...
Do you want to add variables at edit time or run time?
Most editor stuff is done by an FsmBuilder class, but this is not documented. You would have to poke around to figure out how it works...
If you're talking runtime, you could make a new variable and add it to the array yourself:
var myFloatVariable = new FsmFloat("myFloatVariable");
-
I was looking for the latter, adding variables at runtime, and the info you provided is exactly what I needed to know, thanks very much!