-
Notifications
You must be signed in to change notification settings - Fork 6
Mecanator

it's a component that can be added to a state machine state. It's the base class every handler on a state derives from
StateMachineHandler has some predefined handlers : OnStateEnterHandler, OnStateExitHandler, OnStateIKHandler, OnStateMoveHandler, OnStateUpdateHandler, OnStateMachineEnterHandler, OnStateMachineExitHandler, OnStateNormalizedTimeHandler
-
Execute all the actions under the action list on the first Update frame when a statemachine evaluate this state
-
Execute all the actions under the action list on the last update frame when a statemachine evaluate this state
-
Execute all the actions under the action list right after MonoBehaviour.OnAnimatorIK
-
Execute all the actions under the action list right after MonoBehaviour.OnAnimatorMove
-
Execute all the actions under the action list at each Update frame except for the first and last frame
-
Execute all the actions under the action list on the first Update frame when making a transition to a StateMachine. This is not called when making a transition into a StateMachine sub-state
-
Execute all the actions under the action list on the last Update frame when making a transition out of a StateMachine. This is not called when making a transition into a StateMachine sub-state
-
Execute all the actions under the action list at each fixed interval except for the first and last frame

StateMachineAction has some predefined actions : SetBoolParameter, SetIntParameter, SetFloatParameter, SetLayerWeights, PublishEvent, PublishState, Repeat, LogMessage, DebugBreak, ExecuteDelegateAction, DelegateAction
-
Sets an Animator bool parameter
-
Sets an Animator int parameter, can also give a range, and then randomly fetch a value in this range
-
Sets an Animator float parameter, can also give a range, and then randomly fetch a value in this range
-
Sets the weight of the layer at the given list
-
Publish a event
-
Publish a animator current state info event
-
Replay animation after how many time intervals
-
Logs message to the Unity Console
-
Pauses the editor
-
Execute a delegate action
-
It's the base class every delegate action on a ExecuteDelegateAction from
How to create a custom actions
// You can see them at drop down context menu when you click state machine handler's Actions `+` button
// Use UniEasy.ContextMenuAttribute can easy to pack state machine actions into groups
[UniEasy.ContextMenu ("Actions/SetBoolParameter")]
public class SetBoolParameter : StateMachineAction
{
// Search the script to see the details
...
}