Fsm Variables allow the use of named variables instead of hard-coded values as action parameters. See Fsm Variables.
The user now has the option to enter a speed value or to choose a named Float Variable for the speed. The variable can be manipulated by other actions, exposed in the PlayMakerFsm Inspector, or get/set by other FSMs.
Note: when using an FsmVar, make sure you update the value before using it:
You can get/set the value of an Fsm Variable using the Value property.
You should set variables to default values in the Reset() function. The user can reset the action at any time using the Settings Menu in the Action Editor. Reset() should set variables to sensible default values.
Most Fsm Variables have assignment overrides so you can just say, for example: speed = 10;
NOTE: You should only use this override in the Reset function since it makes a new instance of the variable.
The FsmOwnerDefault type is a little more complicated. It is generally used on Actions that need a Game Object target. An FsmOwnerDefault variable lets the user choose either the Owner of the FSM (the default) or another Game Object as the target.
To get the user's choice use Fsm.GetOwnerDefaultTarget():
NOTE: You will need to check if go is null before proceeding.
If an action parameter should present a dropdown to select a variable (e.g., to store a value in), use the UIHint Attribute with UIHint.Variable.
See also: Action Attributes.
Fsm Variables are guaranteed not to be null at runtime. To check if the user selected None in the UI, use the IsNone property.
NOTE: The Fsm Variable is guaranteed not to be null, but its Value can be null! E.g., fsmGameObjectVariable.Value can be null.