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.
- They compare
Humanoid
,Generic
, andSprite
animations separately for each system. Overall,Sprite
animations are the most efficient, followed byGeneric
, and thenHumanoid
s are least efficient.
Instantiation
Animancer is about the same as Mecanim.
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's used as the baseline since Mecanim also works 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 for all Rig types.
Humanoid | Generic | Sprite |
---|---|---|
The DefaultHumanoid model used in most of the Animancer Samples. | The Paladin J Nordstrom model used in the Weapons sample. | The Knight Sprite used in the old |
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 toAlways 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
AnimancerGraph.KeepChildrenConnected
property set to bothtrue
andfalse
(the default isfalse
):
Disconnected | Connected |
---|---|
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. |
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