Performance

Animancer can be more efficient than other systems if used correctly, though in most cases the differences are small enough not to matter either way.

Recommendation

Most users should ignore this page.

These tests each focus on a single performance metric and even then they show relatively small differences between systems, especially when taking into account everything else a game will be doing. So it's generally better to choose whatever will make development easiest. The same applies to choosing between the different ways of using Animancer.

The Unity Manual also has a page about general Animation Optimization which is still applicable when using Animancer.

Introduction

The following benchmarks compare the performance of several animation systems:

  • Animancer: this plugin.
  • Mecanim: Unity's main animation system based around Animator Controllers.
  • Simple Animation: another animation system made by Unity with the Playables API and available on GitHub.
  • They compare Humanoid, Generic, and Sprite animations separately for each system. Overall, Sprite animations are the most efficient, followed by Generic, and then Humanoids are least efficient.

Instantiation

Animancer is about the same as Mecanim and takes 13-29% less time than Simple Animation.

This benchmark tests the time taken to call Object.Instantiate on a prefab 100 times in a row.

Animancer is tested in two different ways:

Startup Demand
Immediately initializes all the animations that the character might play. It is used as the baseline since Mecanim and Simple Animation also work like that. Does not initialize any animations other than the Idle and would instead only do so "on-demand" when they are actually played. This allows Animancer to instantiate 20-35% faster by splitting parts of the initialization cost into later frames, essentially cheating this test by moving the cost into the Average Frame Rate instead.

Click here to see the results:

Average Frame Rate

Animancer is ~5% faster than Mecanim and Simple Animation for most Rig types except for Sprite animations where Simple Animation is about equal to Animancer.

Humanoid Generic Sprite
The DefaultHumanoid model used in most of the Animancer Examples. The Paladin J Nordstrom model used in the Weapons example. The Knight Sprite used in the old Platformer example.

This benchmark counts the total number of frames rendered in 30 seconds to calculate the average number of frames rendered per second while animating 100 characters.

  • During the test, each model is periodically commanded to play a particular animation from a set of options to include the cost of their commands/fading/etc. in the factors being tested.
    • The sequence was set so that the number of commands given in a row and the number of models fading at a time would change throughout the duration, however the exact same sequence was repeated every time for every system to ensure a valid test.
  • Tests were conducted with the models off-screen (with the Culling Mode set to Always Animate) so their rendering would not affect the frame rate. Otherwise the results are simply smaller numbers that fluctuate much more.
    • This means that the actual practical differences in a real game will be extremely small.
  • In addition to the Startup and Demand modes used in the Instantiation tests, these tests also compare having the AnimancerPlayable.KeepChildrenConnected property set to both true and false:
Disconnected (default is false for Humanoid Rigs) Connected (default is true for Generic Rigs)
Disconnect animations from the Graph Structure when they are not being used (AnimancerNode.Weight == 0) so that Unity does not evaluate them unnecessarily which usually improves performance. Avoid the performance cost of disconnecting and reconnecting things which can outweigh the benefits of having them disconnected.
For Humanoid Rigs, the simple method of initializing animations on Demand and allowing it to Disconnect inactive ones tends to be the most efficient (and by far the most convenient). For Sprite animations, initializing them on Startup and keeping them always Connected seems to be slightly better (this is how Simple Animation works too).

Generic Rigs are also slightly more efficient with KeepChildrenConnected set to false, however Sprite animations gain a much larger benefit from setting it to true so that is the default for all Generic Rigs because it is not possible to automatically differentiate between Sprite animations and other Generic animations at runtime.

Click here to see the results using the full 0-300 range:

Click here to see the results using a partial 250-300 range to make the differences clearer:

Notes

  • Tests were conducted in a runtime build so results would not be affected by editor-only functions.
  • Tests were conducted using Animancer Pro since the code obfuscation of the Animancer Lite DLLs has a (very small) negative impact on performance.
  • Each test was conducted 10 times and the results averaged with any significant outliers removed.

Test Environment

  • Unity: 2019.3.1f1
  • OS: Windows 10
  • CPU: i7-7700HQ @ 2.8GHz
  • GPU: GTX 1050
  • RAM: 8GB