Tips

  • Always kill a tween before its target is destroyed, or enable safe mode and let DOTween take care of it.
  • Even if they're resized automatically, try to set the tweens capacities to the max you'll use in your project (you can enable an editor report which will tell you the max you reached after playing).
  • Sequences don't need to contain tweens in a, uh, sequence. You can have overlapping tweens by using Insert instead of Append.

F.A.Q.

Basic

  • What is a tween engine?

    Read about it here.

  • HOTween to DOTween upgrade guide

    Read it here.

  • How to ignore Unity's Time.timeScale when tweening?

    Just chain the SetUpdate method to a tween, passing a value of TRUE to the isIndependentUpdate parameter.

    transform.DOMoveX(2, 1).SetUpdate(true);
  • How to change the speed of a tween?

    You can either change the speed of all tweens via DOTween.timeScale, or the speed of a single tween via myTween.timeScale.

    // Play all tweens at 2X speed
    								DOTween.timeScale = 2;
    								// Play a single tween at 2X speed
    								myTween.timeScale = 2;
  • What is the difference between SetRecyclable and SetAutoKill?

    DOTween's recycling feature comes in play AFTER a tween is killed. If a tween is never killed, it will never be recycled.

    Once a tween is killed, if it's set as recyclable it will be reset and dropped in a pool, to be reused when needed. Otherwise, it is completely destroyed.

    Consider that a tween's plugin, which means its internal main core, is always recycled independently of what happens to its tween and to the tween recycling settings. That's because DOTween uses a smart approach to plugins, so that only one plugin is used for each type of animation (Vector3, float, etc) at any time, independently of the number of tweens using it.

    NOTE: if you activate tween recycling, you'll have to take care of nulling your tween references once a tween is killed, otherwise they will still be valid but might point either to a pooled tween or to a completely new one (when the pooled one is called in play by another tween creation).

Errors

Weird Things

  • UI text disappears when DOTween is present in the Unity project

    This is a current Unity bug with MDB files. Delete all MDB files from DOTween (both the main folder and the Editor subfolder) and this will be solved.

    NOTE: MDB files are used only to report the correct line and full message in case of logs emitted by a DLL. Removing them won't change anything other then having less detailed DOTween logs.

Advanced

  • How does tween caching work?

    When you create your very first tween, that tween is instantiated as usual, but after that DOTween starts using a pooling system to recycle unused tweens (if recycling is active).

    Each time a tween is killed, that tween is not truly destroyed, but is instead reset, despawned and put in a pool, where it waits for you to need a similar tween again. When you do, DOTween checks its pool and sees if there's a suitable tween already. If there is, it despawns it and gives it back to you as if new but without instantiation and thus no GC allocations. If there isn't it instantiates a new one.

    DOTween requires a different type of tween for each type of value tweened and for Sequences. So for example a Tweener that animates a Vector3 can be recycled for another Vector3 but not for a float. A Sequence can instead be recycled for any other Sequence.

    Example

    Let's say we set the max tweens capacity to 10 Tweeners.

    At startup, we create 5 Vector3 tweens and 5 Quaternion tweens. Since the pool is empty they will all be instantiated. When they finish playing, our pool will contain 10 "empty" tweens.

    Now we create 5 new Vector3 tweens. Since the pool has them, they're spawned instead than instantiated. Again, we let them play and autokill.

    Now we create 5 float tweens. The pool doesn't contain float tweens, so instantiation will happen. Since the max number of pooled tweens has already been reached (it's the same as the tweens capacity, except that while active tween size is automatically incremented when needed, pool size always stays the same as the max active tweens) DOTween will destroy the oldest 5 tweens and instantiate the new ones.

    Tips

    If you just need the same tween over and over but with different values, it's even better to just store a reference to it and change its start/end value or duration directly.

  • Where are the plugins?

    If you ask this, I suppose you're used to how HOTween works, where you have to create a new plugin each time you want to use it. Well, I'm glad to say that plugins are still there, but undercover.

    Simply put, DOTween uses a single plugin instance for all the tweens that require that specific plugin, and it's all managed in the background, which means way way less GC allocations (actually only one per plugin type, the very first time you use it).

    Example

    In HOTween you needed to instantiate a PlugVector3Y plugin to tween just the Y axis of a transform:

    HOTween.To(transform, 1, new TweenParms()
    								  .Prop(new PlugVector3Y("position", 45))
    								);

    In DOTween instead, you just do this:

    transform.DOMoveY(45, 1);

Direct support

General talk and support

Write on this Unity forum thread to find help from other users or write me directly via Twitter or using Demigiant's contact form.

Bugs, feature requests and suggestions

Please report bugs along with feature requests and suggestions on DOTween's GitHub area Issues (the Unity forum thread is also ok for quick bugfixes).

Remember to always write what version of DOTween are you using – you can see your version by opening DOTween's Utility Panel from the Tools menu.

Direct contact

You can contact me directly via Demigiant's contact form.