DOTween is a fast
, fully type-safe
object-oriented animation engine
, optimized for C#
, with tons of advanced features
It is also the evolution of HOTween, my previous Unity tween engine. Compared to it, DOTween is more than 400% faster, more efficient, more type-safe, avoids useless GC allocations and offers new shortcuts and features.
DOTween is compatible with Unity versions 2020 to 5.6.7.
Win, Mac, Linux, Unity WebPlayer, WebGL, iOS, Android,
Windows Phone, UWP (only via IL2CPP starting from v1.2.055), PS Vita (PSM), PlayStation, Xbox, Nintendo Switch + more (didn't test additional platforms but it should work everywhere except with Flash export)
- Speed and efficiency
- Not only very fast, but also very efficient: everything is cached and reused to avoid useless GC allocations.
- IntelliSense and type-safety
- All code is complete with XML comments and organized to get the most out of IntelliSense. Also, everything is type-safe: no strings anywhere.
- Shortcut extensions that directly extend common objects like this:
// Move a transform to position 1,2,3 in 1 second
transform.DOMove(new Vector3(1,2,3), 1);
// Scale the Y of a transform to 3 in 1 second
// Pause a transform's tween
- Extremely accurate
- Time is calculated in a very precise way. This means that 1000 loops of 1 second each will play exactly as long as a single loop of 1000 seconds.
- Logical and easy to use API
- An API made to boost efficiency, intuitiveness and ease of use.
- Animate everything (almost)
- DOTween can animate every numeric value and also some non-numeric ones. It can even animate strings, with support for rich-text.
- You can activate/deactivate references to Unity's systems (physics/audio/UI/etc) via DOTween Modules.
- Snapping, axis constraints and other options
- Choose additional options on how to tween your values, like snapping (snaps values to integers) or axis constraints.
- Full control
- Play, Pause, Rewind, Restart, Complete, Goto and tons of other useful methods to control your tweens.
- Combine tweens into Sequences to create complex animations (which don't need to be in a, uh, sequence: they can also overlap each other).
- Blendable tweens
- Some tweens can blend between each other in realtime, thanks to powerful DOBlendable shortcuts.
- Animate stuff along both linear and curved paths, with additional options for the orientation of your traveling agents.
- Change values and duration while playing
- Change a tween's start/end values or duration at any moment, even while playing.
- Safe mode
- Activate the optional safe mode and let DOTween take care of unexpected occurrences, like a tween's target being destroyed while playing.
- Yield for coroutines
- Various "WaitFor…" methods to use inside coroutines, that allow you to wait for a tween to be completed, killed, started, or for it to reach a given position or loops (and if you have Unity 5.3 or later, CustomYieldInstructions are also implemented).
- Multiple rotation modes
- Rotation tweens can take the shortest route, the full one, or use local or world-based axes.
- Shared methods
- Is it a Tweener or a Sequence? Who cares? They both inherit from Tween, thus you can store them and control them in the same way.
- DOTween is built with an extensible architecture in mind, which allows you to create your own tween plugins as separate files.
- Extra virtual methods to do stuff like calling a function after a given delay.
- All the basics
- Callbacks, Loops, Ease (AnimationCurves and custom ease functions included), SpeedBased and many other tweening options. Also, choice of update type: regular, fixed, late, plus options to make it timeScale-independent.
DOTween Utility Panel
A utility panel that lets you activate/deactivate Modules and setup default DOTween settings/options, plus check for updates, etc.
If you select the [DOTween] GameObject while playing, the corresponding Inspector will show you useful informations, plus buttons to directly open the online documentation and check if you have the latest version.
DOTween Pro is out and extends DOTween with new scripting shortcuts, a visual animation editor, a visual path editor, plus extra features for 2D Toolkit and TextMesh Pro.
Read more here
DOTween VS HOTween
After gaining experience by spending the last years on HOTween, I created DOTween from scratch, with the aim of making the tween engine I truly wanted to use, so there's a lot of differences between the two. DOTween still maintains the flexible object-oriented approach of HOTween (actually, it's much more flexible), but also…
- is much faster (both while running then when starting a tween), more efficient and uses less memory
- caches and reuses stuff automatically (if you want) and doesn't generate any useless GC allocations
- doesn't require an alternate Micro version to run on certain platforms
- allows to change start/end values, duration and other properties even while a tween is running
- has tons of shortcuts to simplify tweening known objects like transforms
- has a similar but different API and doesn't require a TweenParms object anymore: all settings are chained directly to the tween in a much more logical way
- has more "WaitFor…" methods to use with coroutines
- has a much smarter internal architecture
- is completely type-safe: doesn't use any strings nor Reflection at all
- allows to set custom ease functions
- has an optional safe-mode which automatically takes care of targets being destroyed while a tween is running
- introduces lambdas instead of strings (lambdas are awesome, in general!)
- is easier to extend with custom plugins
- comes with extra virtual methods
- is optimized for C# (UnityScript might be used with it, but it's not recommended nor supported – I honestly don't know about Boo)
- has a new name that hopefully won't be associated with porn
- has many other additional features and is overall much cooler (tadah!)
DOTween is free and open-source like HOTween, but there is a special Pro version which contains extra stuff and that requires a small one-time fee.
I hope you will understand and will support this decision.
Other than that, donations are always welcome :)
Comparison with other engines
If you want, you can download the test package I used (oops sorry, I'll put it up there when I get into beta, otherwise I should update it every hour - but you can still get the most recent one from DOTween's GitHub repo).
All these tests were done from a build, since some of these tween engines (DOTween, HOTween and GoKit) do additional stuff while in the Editor to show editor-only debug informations, and thus testing them outside the editor, where it counts, seemed more fair.
To keep the test accurate download the latest versions of all engines and replace the old ones (the ones used here are from July/August 2014).
You'll find more tests for the tween of generic floats because GoKit and iTween couldn't tween as many as the other engines, but I still wanted to show high-level results.
64,000 generic floats in a loop
16,000 generic floats in a loop
2,000 generic floats in a loop
4,000 transforms looping around