Performance: Root motion
MEDIUM IMPACT
Root motion affects animation playback and character movement performance, impacting frame rendering and input responsiveness.
Animator.applyRootMotion = true; // Apply root motion only when character is visible and active if (characterIsVisible) { Animator.applyRootMotion = true; } else { Animator.applyRootMotion = false; }
Animator.applyRootMotion = true;
// Root motion applied every frame without optimization or culling| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Continuous root motion without culling | N/A | N/A | High CPU usage delays frame rendering | [X] Bad |
| Conditional root motion with visibility checks | N/A | N/A | Reduced CPU usage, smoother frames | [OK] Good |