PrimeTween: allocation-free Unity animations, and where the zero-allocation claim breaks
High-performance, allocation-free tween library for Unity. Create animations, delays, and sequences in one line of code.
At a glance
- What is it?
- PrimeTween is a C# tween library for Unity that eliminates heap allocations during tween execution. The library covers Transforms, UI, Camera, Materials and AudioSource, but its zero-allocation headline breaks at the edges of the callback system.
- Who is it for?
- PrimeTween suits Unity developers who animate at runtime, need profiler-clean GC behaviour during tween execution, and want to express animation intent in code rather than in Animator state machines. The allocation-free claim holds for the tween lifecycle itself, but every OnComplete callback that captures a variable in a closure will allocate; audit those call sites before relying on that claim in profiling sessions.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 86 days ago.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 11, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Where Unity's built-in Animator falls short of runtime code needs
Unity ships two systems for moving values over time. The Animator is a state machine designed around authored clips and transitions defined in the editor. It handles character animations and complex blended states well, but it is the wrong layer for runtime behaviour that reacts to player input, spawn events, or procedural responses, because its states are authored assets, not code calls.
Coroutines fill part of that gap. A coroutine can lerp a value over frames with a while loop, but writing them manually produces boilerplate, and naive implementations generate garbage through IEnumerator allocations. PrimeTween targets exactly this usage: Unity game developers who need to move values at runtime, want a one-line API, and care about keeping the garbage collector quiet during gameplay.
Out of the box, PrimeTween animates UI, UI Toolkit, Materials, Camera properties, Transforms, and AudioSource. For anything not in the built-in set, Tween.Custom() handles arbitrary value interpolation with a custom callback.
Installing from the Asset Store and running the first tween
Two installation paths exist. Importing from the Asset Store at assetstore.unity.com/packages/slug/252960 is preferred because that package includes a Demo scene. Unity Package Manager (UPM) is an optional alternative listed in the table of contents under "Install via Unity Package Manager (UPM)", but no actual UPM command appears in the README.
After import, the namespace is PrimeTween. A position tween on the Y axis in one second with easing looks like this:
using PrimeTween;
// Animate 'transform.position.y' from the current value to 10 in 1 second using the Ease.InOutSine
Tween.PositionY(transform, endValue: 10, duration: 1, ease: Ease.InOutSine);
// Rotate 'transform' from the current rotation to (0, 90, 0) in 1 second
Tween.Rotation(transform, endValue: Quaternion.Euler(0, 90, 0), duration: 1);
// Rotate 'transform' around the y-axis by 360 degrees in 1 second
Tween.EulerAngles(transform, startValue: Vector3.zero, endValue: new Vector3(0, 360), duration: 1);To discover which properties are animatable, type Tween. and let the IDE's autocomplete enumerate the available methods. For XML documentation to appear in that popup, one step is required: in Unity Preferences under External Tools, enable "Generate .csproj files for Local tarball" and press "Regenerate project files".
When a target property is not in the built-in list, Tween.Custom() handles it. The repository also lists a Documentation/ directory at the root, where the full API reference lives.
Where the zero-allocation claim holds, and where closures break it
PrimeTween's headline promise is "No runtime memory allocations, ever." Tween state lives in a pool of pre-allocated structs rather than a freshly heap-allocated class instance for each tween, which is what makes that claim true for the tween lifecycle itself.
The boundary is explicit in the README. After showing an OnComplete example, a callout block reads: "But wait! There is a memory allocation in the example above." The example is:
Tween.Scale(transform, endValue: 0, duration: 1, endDelay: 0.5f)
.OnComplete(() => Destroy(gameObject));Calling Destroy() inside the lambda captures `this` in a closure, and that closure allocates on the heap. PrimeTween directs developers to a "zero allocations with delegates" section in the documentation for how to pass callbacks without closures.
This distinction matters in the Unity Profiler. A developer who sees allocation spikes at animation completion has not found a bug in PrimeTween's tween machinery. The allocation comes from the callback structure. Delays created with Tween.Delay do not have this problem: they are allocation-free and work inside sequences, coroutines, and async/await flows.
The four CycleMode values, and why Incremental drifts instead of oscillating
Repeating an animation uses two parameters on any Tween. method: cycles, an integer, and cycleMode, a CycleMode enum value. Setting cycles to -1 repeats indefinitely.
The CycleMode enum has four members:
- Restart: the default; starts the tween from its beginning at each cycle. - Yoyo: animates forward, then backward, with the same easing in both directions. - Rewind: also reverses, but applies easing in reverse on the backward pass, so acceleration and deceleration are mirrored. - Incremental: at the end of each cycle, adds the difference between endValue and startValue to the running endValue. A tween that moves position.x from 0 to 1 will move it from 1 to 2 on the second cycle, then from 2 to 3 on the third.
Yoyo oscillates the object between the original start and end values. Incremental drives the value further in one direction with each cycle, which means the object does not return to its starting position. A game using Incremental by mistake where Yoyo is intended will find its transforms drifting off screen.
Tween.PositionY(transform, endValue: 10, duration: 0.5f, cycles: 2, cycleMode: CycleMode.Yoyo);For sequences, the same parameters go on Sequence.Create:
Sequence.Create(cycles: 2, CycleMode.Yoyo)
.Chain(Tween.PositionX(transform, 10, duration))
.Chain(Tween.PositionY(transform, 20, duration));After a tween starts, SetRemainingCycles(int cycles) modifies cyclesTotal so the animation stops after that many remaining cycles. The documentation also lists a SetRemainingCycles(bool stopAtEndValue) overload, though the README excerpt cuts off before completing that entry's description.
Camera shake, position shake, rotation shake, and punch each target a different component
PrimeTween includes named methods for common motion-feel effects. They share strength, duration, and frequency parameters but target different components.
Tween.ShakeCamera takes a Camera component and a strengthFactor. A value of 0.5f is medium and 1.0f is heavy:
// Shake the camera with heavy strength (1.0f) for a duration of 0.5f seconds and a frequency of 10 shakes per second
Tween.ShakeCamera(camera, strengthFactor: 1.0f, duration: 0.5f, frequency: 10);Tween.ShakeLocalPosition and Tween.ShakeLocalRotation target a Transform directly. The strength parameter is a Vector3, which provides per-axis control over the shake amplitude:
// Shake the y-axis position with an amplitude of 1 unit
Tween.ShakeLocalPosition(transform, strength: new Vector3(0, 1), duration: 1, frequency: 10);
// Shake the z-axis rotation with an amplitude of 15 degrees
Tween.ShakeLocalRotation(transform, strength: new Vector3(0, 0, 15), duration: 1, frequency: 10);Tween.PunchLocalPosition is behaviourally different from the shake methods. Instead of oscillating randomly around the origin, it pushes the transform in a given direction and lets it settle back:
var punchDir = transform.up;
Tween.PunchLocalPosition(transform, strength: punchDir, duration: 0.5f, frequency: 10);The repository topics list both camera-shake and screen-shake as separate entries, which corresponds to the API split between the Camera-targeted method and the Transform-targeted methods.
Sequences, callbacks, delays and async coordination
Sequences let tweens run one after another without nesting callbacks. Sequence.Create() accepts cycles and CycleMode parameters, and each .Chain() call appends a tween to run after the previous one finishes. Delays are valid sequence entries and behave like normal tweens inside them.
Callbacks attach via .OnComplete():
Tween.Position(transform, endValue: new Vector3(10, 0), duration: 1)
.OnComplete(() => SomeMethod());Tween.Delay runs standalone or inside a sequence:
Tween.Delay(duration: 1f, () => Debug.Log("Delay completed"));PrimeTween exposes both an awaitable interface for async/await and a yieldable interface for Unity coroutines. Both are listed in the table of contents as supported coordination patterns. The exact method signatures live in the Documentation/ directory at the repository root, not in the README.
Inspector integration is part of the feature set: animation properties can be adjusted from the Inspector without changing code. The Documentation/ directory holds the detail on how that works.
PrimeTween PRO features and the DOTween migration path
PrimeTween ships in two tiers. The Asset Store package provides the full code API. PrimeTween PRO, a separate package at https://u3d.as/3WtK, adds two features absent from the free tier: a Tween Animation component described as being able to animate anything without code, and per-object material animations. These are editor-facing features for designers who want to create tweens without scripting.
For teams moving from DOTween, the project includes a DOTween adapter. A migration cheatsheet is included, along with documented compatibility for DOTween's PlayForward, PlayBackwards, and Restart methods. The adapter acts as a translation layer, so existing DOTween call sites can route through PrimeTween without a full rewrite. A performance comparison between PrimeTween and other tween libraries is at github.com/KyryloKuzyk/PrimeTween/discussions/10.
The last push was on 2026-07-18, and version history is in changelog.md at the root.
Editorial conclusion
PrimeTween suits Unity developers who animate at runtime, need profiler-clean GC behaviour during tween execution, and want to express animation intent in code rather than in Animator state machines. The allocation-free claim holds for the tween lifecycle itself, but every OnComplete callback that captures a variable in a closure will allocate; audit those call sites before relying on that claim in profiling sessions. Teams migrating from DOTween will find the included adapter reduces the cost of switching. Developers considering PrimeTween PRO should verify the Tween Animation component covers their specific asset types before purchasing from https://u3d.as/3WtK. The licence file at the repository root is not classified by GitHub as a standard type, so read it before shipping a commercial title.
Frequently asked questions
How do I install PrimeTween in Unity?
Import from the Unity Asset Store at assetstore.unity.com/packages/slug/252960, which is the preferred path and includes a Demo scene. Unity Package Manager is listed as an optional alternative, but no UPM command appears in the README.
Does PrimeTween really have zero allocations?
The tween lifecycle itself is allocation-free because state lives in pre-allocated structs. Closures passed to OnComplete that capture a local variable or `this` do allocate, and the README flags this explicitly. A zero-allocations-with-delegates section in the documentation covers how to avoid it.
Can I use PrimeTween instead of DOTween?
PrimeTween includes a DOTween adapter that routes DOTween calls through PrimeTween, along with a migration cheatsheet covering PlayForward, PlayBackwards, and Restart compatibility.
What is PrimeTween PRO?
PrimeTween PRO is a separate Asset Store package at https://u3d.as/3WtK that adds a Tween Animation component for creating animations without code and per-object material animations. The free version provides only the code-based API.
What CycleMode should I use for a back-and-forth animation?
CycleMode.Yoyo animates forth and back with the same easing in both directions. CycleMode.Rewind also reverses but applies easing in reverse on the backward pass. CycleMode.Incremental is different: it adds the original range to the end value each cycle, so the value drifts in one direction rather than oscillating.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/kyrylokuzyk-primetween)