April
27
2015

Learn more about animation machines and what you can use them for.

Animation machines are Unity components that are added to game objects. They’re mostly used in relation with animator components or joints, e.g. to react on animator IK updates or breaking joints on a game object.

An animation machine component can be added through the components menu (Makinom > Machines > Animation Machine) or the scene wizard (Add Machine > Animation Machine). A game object with an animation machine is represented in the Unity scene view by this gizmo icon:

AnimationMachineComponent Icon

You can learn more about machine components in general and their basic settings in this how-to.

Start Types

An animation machine is started by animation callback functions.

Animator IK

Started by animator components immediately before it updates its internal IK (inverse kinematics) system. It’s implemented in the component’s OnAnimatorIK function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • layerIndex (int)
    Stores the layer on which the IK solver is called.

Additional Start Conditions

The Animator IK start type can optionally check the layer index the OnAnimatorIK function was called from. This can be used to e.g. only start the machine when coming from a specific layer.

Example

This start type can be used to set the positions of the IK goals and their respective weights. Use an Animator Weight node to set the position and weight of IK goals.

Animator Move

Started by animator components each frame after the state machines and the animations have been evaluated, but before Animator IK. It’s implemented in the component’s OnAnimatorMove function.

Example

This start type can be used to move a game object based on root motion. Use a Store Parameter node to store parameters from an animator controller into variables and use them in one of the various Movement nodes (e.g. a Move node) to move the game object.

Joint Break

Started when a joint attached to the machine’s game object broke. It’s implemented in the component’s OnJointBreak function. When a force that is higher than the breakForce of the joint, the joint will break off.

Local Start Variables

This start type will automatically initialize the following local variables.

  • breakForce (float)
    Stores the break force that was applied to the joint.

Additional Start Conditions

The Joint Break start type can optionally check the break force the OnJointBreak function was called with. This can be used to e.g. only start the machine when the break force is between two defined values.

Example

This start type can be used to animate the breaking of a joint. Use a Play Sound node to play an audio clip or spawn a particle effect prefab with a Spawn Prefab node.

Animation Event

Started when receiving an UI or animation event with no parameter.

Animation events are added to animations – select the AnimationEvent ( ) function in the animation event.

UI events are added to UI components, e.g. add it as an event to the On Click () event list of a Button component by selecting the AnimationMachineComponent > AnimationEvent () function.

Example

This start type can be used to play sounds at specific points in an animation. Use a Play Sound node to play an audio clip.

Animation Event (int)

Started when receiving an UI or animation event with an int parameter.

Animation events are added to animations – select the AnimationEventInt ( int ) function in the animation event.

UI events are added to UI components, e.g. add it as an event to the On Click () event list of a Button component by selecting the AnimationMachineComponent > AnimationEventInt (int) function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • parameter (int)
    Stores the int parameter that was used by the animation event.

Additional Start Conditions

The Animation Event (int) start type can optionally check the int parameter that was used by the animation event. This can be used to e.g. only start the machine when the parameter is between two defined values.

Example

This start type can be used to play sounds at specific points in an animation. Use a Play Sound node to play an audio clip.

Animation Event (float)

Started when receiving an UI or animation event with a float parameter.

Animation events are added to animations – select the AnimationEventFloat ( float ) function in the animation event.

UI events are added to UI components, e.g. add it as an event to the On Click () event list of a Button component by selecting the AnimationMachineComponent > AnimationEventFloat (float) function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • parameter (float)
    Stores the float parameter that was used by the animation event.

Additional Start Conditions

The Animation Event (float) start type can optionally check the float parameter that was used by the animation event. This can be used to e.g. only start the machine when the parameter is between two defined values.

Example

This start type can be used to play sounds at specific points in an animation. Use a Play Sound node to play an audio clip.

Animation Event (string)

Started when receiving an UI or animation event with a string parameter.

Animation events are added to animations – select the AnimationEventString ( String ) function in the animation event.

UI events are added to UI components, e.g. add it as an event to the On Click () event list of a Button component by selecting the AnimationMachineComponent > AnimationEventString (string) function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • parameter (string)
    Stores the string parameter that was used by the animation event.

Additional Start Conditions

The Animation Event (string) start type can optionally check the string parameter that was used by the animation event. This can be used to e.g. only start the machine when the parameter contains a defined text.

Example

This start type can be used to play sounds at specific points in an animation. Use a Play Sound node to play an audio clip.

UI Game Object

Started when receiving an UI or animation event with a game object parameter – the game object will be used as the starting object.

Animation events are added to animations – select the UIGameObject ( GameObject ) function in the animation event.

UI events are added to UI components, e.g. add an event to the On Click () event list of a Button component by selecting the AnimationMachineComponent > UIGameObject (GameObject) function.

Example

This start type can be used to play sounds at specific points in an animation. Use a Play Sound node to play an audio clip.