Skip to content

Mecanator

chaolun edited this page Aug 14, 2019 · 2 revisions

StateMachineHandler

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

  • OnStateEnterHandler

    Execute all the actions under the action list on the first Update frame when a statemachine evaluate this state

  • OnStateExitHandler

    Execute all the actions under the action list on the last update frame when a statemachine evaluate this state

  • OnStateIKHandler

    Execute all the actions under the action list right after MonoBehaviour.OnAnimatorIK

  • OnStateMoveHandler

    Execute all the actions under the action list right after MonoBehaviour.OnAnimatorMove

  • OnStateUpdateHandler

    Execute all the actions under the action list at each Update frame except for the first and last frame

  • OnStateMachineEnterHandler

    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

  • OnStateMachineExitHandler

    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

  • OnStateNormalizedTimeHandler

    Execute all the actions under the action list at each fixed interval except for the first and last frame

StateMachineAction

StateMachineAction has some predefined actions : SetBoolParameter, SetIntParameter, SetFloatParameter, SetLayerWeights, PublishEvent, PublishState, Repeat, LogMessage, DebugBreak, ExecuteDelegateAction, DelegateAction

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
    ...
}

Clone this wiki locally