In this lesson, you will learn how to streamline your AnimGraph logic to ensure your character animations run efficiently, even when many characters are onscreen.
As your projects grow, complex Animation Blueprints (AnimBPs) can become a major source of frame rate drops. The key to maintaining performance is to minimize the "cost" of your graph by reducing the number of nodes evaluated every frame.
The "Cost" of Animation Logic
Every node in your AnimGraph performs a calculation. If you have deep state machines, complex blend trees, or unnecessary logic running every frame, the CPU must process those calculations for every character instance.
To optimize, apply these three best practices:
- Avoid "Heavy" Nodes: Nodes like
Blend Per BoneorLayered Blend Per Boneare useful, but expensive. If you have many characters, try to use simpler blending methods when the character is at a distance or off-screen. - Use Cached Poses: Instead of recalculating the same pose in multiple states, use a
Cache Posenode. Once a pose is cached, you can reference it as many times as you like usingUse Cached Posenodes without re-running the underlying logic. This is essentially "calculating once, using twice." - Limit Tick Rates: If a character isn't visible or is far away, they don't need a high-frequency update. You can use the
Mesh Component Update Flagsettings in your character'sSkeletalMeshComponentto set the animation tick rate to "Only Tick Pose When Rendered."
Example: Simplifying Logic
If you are blending an additive layer, rather than calculating it continuously, place your complex logic behind a gate or a simple branch. For example, if you have an Aim Offset, only trigger the blend logic if the character's weapon is actually equipped:
// Logic flow inside AnimGraph
if (bIsWeaponEquipped) {
// Perform complex Aim Offset blending
} else {
// Skip to final output
}
By keeping your logic lean and avoiding redundant calculations, you ensure that your animation system remains a silent background process rather than a bottleneck for your frame rate.
Key Takeaway: Optimize your AnimBP by reusing results with Cached Poses, minimizing complex blend nodes, and throttling updates for characters not currently in view.