Hey, I’ll be short =)
I’m going to compare quickly 3 types of tween animations: built-in Legacy Animation, HOTween and DOTween.
I use 5k objects from prefabs as tweens targets.
Tweens are looped, start by default, have 1 sec length and tweening transform position from (0, 0, 0) to (1.3, 1.4, 1.5).
Used software info:
– Unity 4.6 Beta 16.
– HOTween v1.3.350.
– DOTween 0.7.310 Alpha
– Unity profiler with ‘Deep Profile’ enabled.
Initialization resources usage
Let’s compare initialization time and GC allocations first.
Time + GC Allocation + real memory allocation. Time is frame total time. Memory usage includes memory used by objects.
Animation
Frame time: ~166.7 ms (from 3 samples)
GC Allocations: 97.8 KB
Total memory usage: ~20.07 MB (from 3 samples)
Frames to initialize: 1
HOTWeen
Frame time: ~268.68 ms (from 3 samples) + ~55.62 ms (from 3 samples) for second frame
GC Allocations: 4293 KB + 1.3 KB for second frame
Total memory usage: ~25.1 MB (from 3 samples)
Frames to initialize: 2
DOTween
Frame time: 122.86 ms (from 3 samples)
GC Allocations: 1800 KB (may be kept away from GC using internal pooling)
Total memory usage: ~10 MB (from 3 samples)
Frames to initialize: 1
Resources usage per frame
Now tweening performance, allocations per frame (excluding constant Unity-releated allocators) and total memory usage while running tweens (memory usage increases for a while after initialization).
Time is frame total time.
Animation
Frame time: 12-13 ms
GC Allocations: 0 B
HOTween
Frame time: 36-40 ms
GC Allocations: 420 B – 672 B (sad face here)
DOTween
Frame time: 9 ms
GC Allocations: 0 B
Brand new DOTween gets the best Unity tweening solution award from me!
And it’s free, very flexible, user-friendly and has a great author. It definitely desires donation!
Grab messy benchmark sources (should be compatible with Unity 4.5) here.