NsTween moves a value from a start to an end over time, with an easing curve. Use it for UI motion and for small game motion, such as a floating pickup, a door, or a color pulse. You start a tween from C++ with FNsTween::Play, or from Blueprint with an async node.
NsTween is not a replacement for UMG animations or for Sequencer. It does not replicate, and it does not follow the game pause or the time dilation. Tweens run on real time.
Linear, CustomBezier with the default points (0.25, 0.1, 0.25, 1.0)InSine, OutSine, InOutSineInQuad, OutQuad, InOutQuadInCubic, OutCubic, InOutCubicInQuart, OutQuart, InOutQuartInQuint, OutQuint, InOutQuintInExpo, OutExpo, InOutExpoInCirc, OutCirc, InOutCircInElastic, OutElastic, InOutElasticInBounce, OutBounce, InOutBounceInBack, OutBack, InOutBackNsTween folder into the Plugins folder of your project.NsTween in Edit > Plugins."NsTween" to the dependencies of your game module in its Build.cs file.The plugin needs no project settings. The module builds only for Win64.
Event BeginPlay, add the Tween Float node.InOutQuad.Set Actor Location, and use Value as X.#include "NsTween.h"
void AMyActor::BeginPlay()
{
Super::BeginPlay();
const FVector Start = GetActorLocation();
FNsTween::Play(0.f, 100.f, 2.f, ENsTweenEase::InOutQuad, [this, Start](float Value)
{
SetActorLocation(Start + FVector(Value, 0.f, 0.f));
})
.SetOwner(this);
}
Play returns a builder. Chain the options in the same statement. The tween starts when the builder is destroyed, or when you call Pause, Resume, Cancel, IsActive, GetHandle, or IsValid on it. The start and the end must have the same type.
| Type | C++ | Async node | Spec node |
|---|---|---|---|
| Float | FNsTween::Play |
Tween Float |
Play Float Tween |
| Vector | FNsTween::Play |
Tween Vector |
Play Vector Tween |
| Vector 2D | FNsTween::Play |
Tween Vector 2D |
None |
| Rotator | FNsTween::Play |
Tween Rotator |
Play Rotator Tween |
| Quat | FNsTween::Play |
Tween Quat, Tween Quat From Rotator |
None |
| Transform | FNsTween::Play |
Tween Transform |
Play Transform Tween |
| Linear Color | FNsTween::Play |
Tween Linear Color |
Play Color Tween |
Each async node also has a Custom Curve version, for example Tween Float Custom Curve.
In Blueprint:
In C++:
SetLoops(Count) on the builder, with a count above 0.On Loop (OnLoop in C++) fires at the end of each loop, the last loop included. A count of 0 or less turns looping off. To loop with no end, use ping-pong with no count, or an FNsTweenSpec with Wrap Mode Loop and Loop Count 0.
In Blueprint:
In C++:
const float StartZ = GetActorLocation().Z;
FNsTween::Play(StartZ, StartZ + 40.f, 1.f, ENsTweenEase::InOutSine, [this](float Z)
{
FVector Location = GetActorLocation();
Location.Z = Z;
SetActorLocation(Location);
})
.SetPingPong(true)
.SetOwner(this);
On Ping Pong (OnPingPong in C++) fires at each change of direction.
A Rotator tween takes the shortest path, so 0 to 360 degrees does not turn.
In Blueprint:
Custom Curve node, for example Tween Float Custom Curve.In C++:
SetCurveAsset(Curve) on the builder.The tween reads the curve at a time from 0 to 1, and uses the curve value as the alpha.
FNsTweenSpec. In Blueprint, drag from a Spec pin and add a Make node.CustomBezier.Play ... Tween node, or to FNsTween::Play(Spec, Factory) in C++.Play Float Tween.Event Tick.The tween writes the value into Target on each tick. It sends no events.
In Blueprint, with a handle from a Play ... Tween node:
Pause Tween, Resume Tween, or Cancel Tween with the handle.With an async node, call Pause, Resume, Stop, or Restart on the async action object that the node returns.
In C++:
#include "NsTweenFunctionLibrary.h"
const FNsTweenHandle Handle = FNsTween::Play(0.f, 1.f, 0.3f, ENsTweenEase::OutCubic, [this](float Alpha) { SetAlpha(Alpha); });
UNsTweenBlueprintLibrary::CancelTween(Handle, true);
Cancel Tween applies the end value when Apply Final is true. A cancel also fires On Complete. These commands take effect at the next tick of the tween subsystem.
SetOwner(this) on the builder.The tween stops when the owner is destroyed. It does not fire On Complete then. The async nodes set no owner. Call Stop on the async action in Event EndPlay if the tween must stop with the actor.
OnComplete, OnLoop, or OnPingPong on the builder with a function.| Setting | Default | Effect |
|---|---|---|
| Start, End | Float: 0 and 1. Vector, Vector 2D, Rotator: zero. Linear Color: black and white | The values of the tween. Quat and Transform have no default |
| Duration Secs | 1 | The time of one pass. A value of 0 or less gives an error |
| Ease Type | InOutQuad |
The easing preset. The Custom Curve nodes have Curve here |
| Curve | None | The Float Curve of a Custom Curve node. None gives a linear ease |
| Delay | 0 | The wait before the first pass, in seconds |
| Loops | 0 | The number of loops, or of ping-pong pairs. 0 or less: no loop |
| Ping Pong | False | Play forward, then backward |
| Loop Delay | 0 | No effect. A value above 0 logs a warning |
| Ping Pong Delay | 0 | No effect. A value above 0 logs a warning |
| Can Tick During Pause | False | No effect. True logs a warning |
| Use Global Time Dilation | True | No effect. False logs a warning |
Delay and all pins after it are advanced pins.
FNsTweenSpec)| Setting | Default | Effect |
|---|---|---|
| Duration Seconds | 0.5 | The time of one pass |
| Delay Seconds | 0 | The wait before the first pass. A negative value counts as 0 |
| Time Scale | 1 | The speed multiplier. A negative value counts as 0, and 0 stops the tween from moving |
| Wrap Mode | Once |
Once, Loop, or PingPong. A Loop Count above 0 turns Once into Loop |
| Loop Count | 0 | The number of loops, or of ping-pong pairs. 0 with Loop or PingPong: no end |
| Direction | Forward |
Backward starts at the end value and plays to the start value |
| Easing Preset | InOutSine |
The easing preset. CustomBezier uses Bezier Control Points. CurveAsset uses Curve Asset |
| Bezier Control Points | (0.25, 0.1, 0.25, 1.0) | The two inner points of the cubic Bezier: X, Y, then Z, W |
| Curve Asset | None | The Float Curve for CurveAsset. None gives a linear ease |
| Owner | None | The tween stops when this object is destroyed |
| Setting | Default | Effect |
|---|---|---|
SetLoops(int32) |
0 | The number of loops, or of ping-pong pairs. 0 or less turns looping off |
SetPingPong(bool) |
False | Play forward, then backward |
SetDelay(float) |
0 | The wait before the first pass, in seconds |
SetTimeScale(float) |
1 | The speed multiplier. The minimum is 0.0001 |
SetCurveAsset(UCurveFloat*) |
None | A Float Curve as the ease |
SetOwner(UObject*) |
None | The tween stops when the owner is destroyed |
The builder calls work only before the tween starts. After that, they do nothing.
ENsTweenEase)Linear, and the In, Out, and InOut versions of Sine, Quad, Cubic, Quart, Quint, Expo, Circ, Elastic, Bounce, and Back. Also CustomBezier and CurveAsset.

LogNsTween. It shows the warnings of the async nodes, and “Cannot spawn tween without strategy.”Is Tween Active returns true while a tween runs or is paused.NsTween::Tick and NsTweenSubsystem::Tick. See them in Unreal Insights with the CPU channel.| Problem | Cause | Fix |
|---|---|---|
| A tween does nothing in the editor | Tweens tick only while a game world exists | Test in Play In Editor |
Is Tween Active is false right after the start |
The tween joins the subsystem at its next tick | Test it one frame later |
SetLoops(-1) plays one time |
A negative count turns looping off | Use a count above 0, or ping-pong with no count |
| A builder call has no effect | The tween started already | Chain all options before any control call |
| A Rotator tween from 0 to 360 does not turn | A Rotator tween takes the shortest path | Tween a float yaw |
On Complete fires after Stop or Cancel Tween |
A cancel also fires On Complete |
Check a flag of your own in the event |
Set Time Multiplier has no effect |
It changes the speed only at the next Restart |
Call Restart after it |
| A tween keeps running after its actor is destroyed | The tween has no owner | Call SetOwner, or set Owner in the spec |
| A warning about Loop Delay, Ping Pong Delay, pause, or time dilation | These async inputs have no effect | Reset them to their defaults |
A Custom Curve node plays a linear ease |
Curve is empty | Set Curve |
On Complete fires.Backward tween and a ping-pong tween with a count therefore finish on the end value.Play ... Tween nodes keep the address of Target. Use a member variable, and set Owner to the object that holds it.Play and the async nodes blend a Linear Color in HSV. Play Color Tween blends it in RGB.Restart, the async node fires On Complete for the old tween and then ends. The new tween runs, but the node sends no more events after it is garbage collected.UNsTweenSequence holds a list of specs, but no code plays it.