Skip to content

Position

UnBocal edited this page Apr 1, 2026 · 2 revisions

Position

UBTween.Position interpolates the position of an object.

Supported Objects:

Target Value changed (Ref Global) Value changed (Ref Local)
Transform Transform.position Transform.localPosition
RectTransform RectTransform.position RectTransform.localPosition


Use Current Position As Start :

UBTween.Position(
    transform,                  // Target Object
    new Vector3(0f, 1f, 0f),    // End Position
    1f);                        // Duration

PositionCurrentToUp



Specify Start Position :

UBTween.Position(
    transform,                  // Target Object
    new Vector3(-1f, .5f, 0f),  // Start Position
    new Vector3(1f, .5f, 0f),   // End Position
    1f);                        // Duration

PositionLeftToRight



Referencial:

It's possible to whether translate the local position or the global position by using the Ref Enum.

Target Value changed (Ref Global) Value changed (Ref Local)
Transform Transform.position Transform.localPosition
RectTransform RectTransform.position RectTransform.localPosition

From Current

UBTween.Position(
    transform,                  // Target Object
    new Vector3(0f, 1f, 0f),    // End Position
    1f,                         // Duration
    Ref.Global);                // Ref

From Specific Start

UBTween.Position(
    transform,                  // Target Object
    new Vector3(-1f, .5f, 0f),  // Start Position
    new Vector3(1f, .5f, 0f),   // End Position
    1f,                         // Duration
    Ref.Local);                 // Referencial


Gif Code :

UBTween.Sequence sequence = new UBTween.Sequence()
{
    // Going Up
    UBTween.Position(transform, Vector3.zero, Vector3.up, duration, Ref.Local) // Going Up
        .SetEase(EaseType.OutExpo),

    // Going Down
    UBTween.Position(transform, Vector3.up, Vector3.zero, duration, Ref.Local) // Going Down
        .SetDelay(duration)
        .SetEase(EaseType.OutBounce),
}.Start().SetLoop();

Clone this wiki locally