Add to your Unity project as a git package using the package manager.
https://github.com/Less3Design/L3-tween.git
L3 Tween is based around exclusively supporting the way I like to write tweens:
private Tween moveTween;
void DoAnimation()
{
Vector3 startPos = transform.position;
Vector3 endPos = Random.insideUnitSphere;
//cancel previous tween, start a new one
moveTween = moveTween.Cancel().New(1f).SetOnUpdate((t) => {
transform.position = Vector3.Lerp(startPos,endPos,t);
});
}Supporting just a single use case lets us keep the business logic to only a couple hundred lines. Here is all the state we mainatin:
public class TweenObject
{
public ushort id;
public ushort version;
public bool active;
public float fromValue;
public float toValue;
public float duration;
public float elapsedTime;
public Ease easeType;
public TweenUpdateType deltaTimeType;
public Action<float> onUpdate;
public Action onComplete;
public Action onCancel;
}It's super good enough. If you need to animate many thousands of objects at once I reccomend treating that like a particle system, don't use tweens.
- TweenObjects are pooled
- Every object is iterated every frame, but if no tweens are active the process takes <
.01ms - The biggest cost will be whatever you allocate and execute inside tweens
- No async job burst etc... because the goal is to keep code as simple as possible
Video showing the system allocating tweens through its pool
Recording.2025-12-20.170935.mp4
- Init custom pool size
- Auto pool expansion
- Probably some perf to improve, could avoid iterating inactive tweens every frame