In this lesson, you will learn how to bypass the Animation Blueprint virtual machine to significantly reduce CPU overhead by utilizing the "Fast Path" for property access.
Why the Virtual Machine Slows You Down
In a typical Animation Blueprint, you often read variables like Speed, IsJumping, or AimPitch to drive your state machine transitions or Blend Spaces. If you access these variables using complex logic, function calls, or Blueprint nodes inside the AnimGraph, Unreal Engine must invoke the Blueprint Virtual Machine (VM) to interpret that logic every single frame. When you have dozens of characters on screen, this interpretation layer adds up to a significant CPU bottleneck.
The Fast Path Solution
The Fast Path is an optimization that allows the engine to skip the VM entirely. Instead of executing code to retrieve a variable, the engine directly accesses the memory address of the property on the owning AnimInstance.
To ensure your logic uses the Fast Path, follow these constraints:
- Access member variables directly: Avoid complex function calls or "Get" nodes that perform calculations.
- Avoid Blueprint nodes: Do not use nodes like
Convert Transform,Make Rotator, orSelectif they require logic execution. - Use Simple Structs: The engine can handle simple member access (e.g.,
float,bool,int), but complex logic will break the optimization.
Example:
Instead of calculating Speed inside your AnimGraph via a function call, calculate the value in the Event Blueprint Update Animation event (the "Event Graph") and store it in a member variable. Then, simply "plug" that member variable into your BlendSpace or State Machine.
// Bad (Slow Path):
// AnimGraph node calling a function every frame to calculate speed.
// Good (Fast Path):
// 1. Event Graph: Speed = CalculatedSpeed;
// 2. AnimGraph: Plug 'Speed' variable directly into node.
When your connection is valid for the Fast Path, you will see a small lightning bolt icon appear on the node. If the icon is missing, the engine is falling back to the slower VM, and you should hover over the node to see a warning explaining which specific operation is breaking the optimization.
Key Takeaway: By caching variable values in the Event Graph and accessing them directly in the AnimGraph, you enable the Fast Path, eliminating costly virtual machine overhead during animation updates.