# Animation Node Functions

Using Animation Node Functions.

Animation Node Functions are function graphs that you can bind to specific Animation Blueprint nodes, at set points in your graph's update cycle, to perform relevant logic. You can use Animation Node Functions to set reference variables, determine a dynamic value, set animation states, and organize complex graphs. Additionally, by using Animation Node Functions, logic is only run at set points in the graph's evaluation, which can significantly increase your animation system's performance.

You can use this document to learn more about how to use Animation Node Functions in Unreal Engine.

## Create a new Anim Node Function

To create a new Animation Node Function, select a node in the AnimGraph, and navigate to the node's Details panel to the Functions section.

You can choose to create a new function on any of the available bindings, depending on your project's needs. Here you can reference a list and description of each of the available functions:

Function | Description
--- | ---
On Initial Update | The engine calls logic bound to this function's graph before updating the Animation Blueprint Node for the first time. You can use this function to set constants for the node that will not change, such as component references or static values.
On Become Relevant | The engine calls logic bound to this function's graph every time the node becomes relevant in the graph. You can use this function to set dynamic values the node requires, but will not update while the node is evaluating.
On Update | The engine calls logic bound to this function's graph every tick when it updates the node. You can use this function to set dynamic values the node requires during its update. For an example workflow using the On Update function binding, see the Distance Matching documentation.

The concept of relevance in the AnimGraph refers to whether or not the engine is evaluating a node. In cases when nodes are not being evaluated, such as when using Blend nodes or State Machines, some nodes may be completely inactive. When this occurs, the node is not relevant. Only nodes currently contributing to the Output Pose are considered relevant.

In this example, the Aim Offset node is not relevant because the Blend node is blended completely to input A.

After selecting when to bind a new function to a node's evaluation cycle, use the (+) Create New Binding option from the binding's drop-down menu to create a new function graph. The function graph will then appear in the My Blueprints panel, where you can name and open the function.

New Animation Node Functions will automatically create Input pins on the Function node which are used to pass through data from the bound Animation Blueprint node to the function's graph. Some function operations may not require the use of these pins, but other logic may require the data they provide, such as if you are using the function to read the current state of the node.

Input Pin | Description
--- | ---
Context | Allows the node to pass data through that is relevant to the node, such as Delta Time, or Inertialization requests.
Node | Allows the node to pass itself through this pin. Typically you will want to convert this pin to a specific node type using a Convert function.

You can also bind an existing function to an Animation Blueprint node, as long as it meets the following requirements:

- The function's Thread Safe property is enabled.

- The function must contain two Inputs. The first being an Anim Update Context Reference type, and the second being an Anim Node Reference type. Each of these inputs must also have their Pass-by-Reference property enabled.

After creating or binding a new function to the Animation Blueprint node, the function will appear on the node in the AnimGraph.

In this example, the Aim Offset logic, for getting a character's rotation and setting the pitch and yaw values, is all contained within the function. The engine only executes this logic while updating the Aim Offset node in the AnimGraph, rather than every tick in the Event Graph, significantly reducing performance costs.

You can open an Animation Node Function directly from the associated Animation Blueprint node using the Magnifying Glass icon next to the function in the graph.

## Graphing in Animation Node Functions

Graphing logic in Animation Node Functions is similar to any other function graph in Unreal Engine.

If you want to further increase your project's performance you can implement Animation Optimzation techniques, such as Property Access, to ensure the engine offloads the Animation Node Function onto the Worker Thread the animation update is executing on.

### Sequence Player Nodes

When binding an Animation Node Function to a Sequence Player or Sequence Evaluator node, you can use Sequence Player nodes within the function to interface and play Animation Sequences directly using the Animation Node Function, providing gameplay teams with more control over animation playback.

Here you can reference a list of the Sequence Player nodes and a description of their function.

Name | Image | Description
--- | --- | ---
| Set Sequence (Evaluator Library) | Set the current Animation Sequence to be played by the connected Sequence Evaluator node.
| Set Sequence (Player Library) | Set the current Animation Sequence to be played by the connected Sequence Player node.
| Set Sequence with Inertial Blending (Evaluator Library) | Set the current Animation Sequence to be played by the connected Sequence Evaluator node using an Inertial Blend with the specified duration.
| Set Sequence with Interior Blending (Player Library) | Set the current Animation Sequence to be played by the connected Sequence Player node using an Inertial Blend with the specified duration.
| Set Explicit Time (Evaluator Library) | Set the current accumulated time of the connected Sequence Evaluator node.

After creating a Sequence Player node in your animation function, and adding it to the graph, you will need to use a Convert node to provide the player node with the proper data.

#### Convert to Sequence Player and Evaluator Nodes

You can use Convert nodes to pass through data from the context Sequence Player and Evaluator Nodes to your Animation Node Function, in order to play animations using the Animation Blueprint Function.

After adding a Sequence Player node to your Animation Node Function graph, add a Convert node from the Function node's Node pin, and connect the output to the Player node's Sequence Player or Sequence Evaluator input.

When building an Animation Node Function directly on a Sequence Evaluator or Player node, you can use the pure function Convert nodes (green).

When creating an Animation Node Function on different node types, for example a state machine, you must use the function convert nodes (blue) to properly convert the node to a Sequence Player or Evaluator.

### State Machines

You can create Animation Blueprint Function Nodes on State Machine nodes, and use them to set Animation States of the State Machine. For example, you can use an On Update function with a Set State node to set an Animation State Machine State without the need to set up transition logic.

#### Set State Node

You can use Set State nodes to directly set an animation state using an Animation Node Function, without the need to set up transition logic. Here, you can reference a list of the Set State node's properties and a description of their function.

Property | Description
--- | ---
Update Context | Connect the Function node's Context pin to provide the Set State node with the requisite context for its operation, such as the delta time, and the current place in AnimGraph.
Node | Set the node reference for the Set State node to use as a binding, the playrate, and the current playback time. Ensure this node is connected to a Convert to Animation State Machine node to properly set the State Machine from the function graph.

When the function is bound directly to a State Machine node, you can use the pure Convert to Animation State Machine node (green).

When the node is not connected directly to a state machine node, you must use the Convert to Animation State Machine function node (blue).

Target State | Set the State the engine plays when this node becomes active. You can bind this pin using a dynamic value, or input a State's name using the field on the node.
Duration | Set the duration of the transition blend from the Current State to the Target State. A value of `0.0` will result in an immediate transition, while larger values will result in slower transitions.
Blend Type | Set the type of blend the node will use to transition the animations between states. You can select from the following options:

- Standard Blend: Performs a linear blend.
- Inertialization: Performs an Inertialized blend.

Blend Profile | Set a blend profile to apply to the blend.
Alpha Blend Option | Set the Alpha blend option to customize the animation blending.
Custom Blend Curve | Set a curve asset to be used as a blend curve.

### Get State Node

You can use the Get State node to determine what Animation State is currently active. Here you can reference a list of the Get State node's Input and Output pins, and a description of their function.

Pin | Description
--- | ---
Update Context | Set the Get State node's context in the graph using the Function node's Context pin. This pin transfers information such as the delta time, and the current place in AnimGraph.
Node | Set the node reference for the Set State node to use as a binding, the playrate, and the current playback time.
Return Value | Returns the current Animation State's name as a string value.

#### Is State Blend In and Out Nodes

You can use the Is State Blending In or Out nodes to determine if the current animation state is blending in or out, in order to build logic to drive blending behaviors. Here you can reference a list of the Is State Blending In or Out nodes pins and a description of their function.

Pin | Description
--- | ---
Update Context | Set the Get State node's context in the graph using the Function node's Context pin. This pin transfers information such as the delta time, and the current place in AnimGraph.
Node | Set the node reference for the Set State node to use as a binding, the playrate, and the current playback time.
Return Value | Returns a boolean of whether or not the state is blending In or Out.

When using the Is State Blending In or Out nodes, you must use a convert to Animation State node to provide the proper Node context data. When updating a function directly on an Animation State output node, you can use the pure Convert to Animation State node (green), for all other applicable instances, use the Convert to Animation State function node (blue).

### Binding a Function to States

You can also bind Animation Node Functions directly to Animation states. However, function graphs can only be bound to Output Nodes within the States AnimGraph.

## Additional Resources

For more information about using Animation Node Functions please see the Lyra example project.

Animation In Lyra

An overview of the Animation System in Lyra

To reference an example workflow of setting up an Animation Node Function, see the Distance Matching documentation.

Distance Matching

An in depth look at Distance Matching in Unreal Engine with an example workflow implementation.

- optimization
- animation blueprints

Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library

On this page

- Create a new Anim Node Function
- Graphing in Animation Node Functions
- Sequence Player Nodes
- Convert to Sequence Player and Evaluator Nodes
- State Machines
- Set State Node
- Get State Node
- Is State Blend In and Out Nodes
- Binding a Function to States
- Additional Resources

## Privacy Preference Center

### Your Privacy

When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer. More information

- ### Strictly Necessary Cookies

  Always Active
  Strictly Necessary Cookies

  These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.

  Cookies Details‎

- ### Performance Cookies

  Performance Cookies

  These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.

  Cookies Details‎

- ### Functional Cookies

  Functional Cookies

  These cookies enable the website to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.

  Cookies Details‎

Consent Leg.Interest
Select All Vendors
Select All Vendors
Select All Hosts

Select All

- REPLACE-WITH-DYANMIC-HOST-ID

  ### 33Across

  View Third Party Cookies
  - Name
    cookie name

- REPLACE-WITH-DYANMIC-VENDOR-ID

  ### 33Across

  3 Purposes

  View Privacy Notice

  ### 33Across

  3 Purposes

  View Privacy Notice
  REPLACE-WITH-DYANMIC-VENDOR-ID

  Consent Purposes

  Location Based Ads

  Consent Allowed

  Legitimate Interest Purposes

  Personalize

  Require Opt-Out

  Special Purposes

  Location Based Ads

  Features

  Location Based Ads

  Special Features

  Location Based Ads

Clear Filters

Information storage and access

By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and personalize content.Privacy Policy