Skip to main content

Transform Binders

Binders for the Transform and RectTransform components.


Transform

TransformPositionBinder

Binds the Transform position.

InterfaceData type
IBinder<Vector3>Sets the position
INumberBinderAccepts numeric types

Inspector properties

PropertyDescription
_spaceSpace.World or Space.Self (local)
ConverterIConverter<Vector3, Vector3> (optional)

Modes: OneWay, OneTime, OneWayToSource (TwoWay is not allowed).

[ViewModel]
public partial class CharacterViewModel
{
[OneWayBind] private Vector3 _position;
}

TransformRotationBinder

Binds the rotation, Transform.rotation / Transform.localRotation (Quaternion).

PropertyDescription
_spaceSpace.World (rotation) or Space.Self (localRotation)

Modes: OneWay, OneTime, OneWayToSource.


TransformEulerAnglesBinder

Binds the Euler angles, Transform.eulerAngles / Transform.localEulerAngles (Vector3).

PropertyDescription
_spaceSpace.World (eulerAngles) or Space.Self (localEulerAngles)

Modes: OneWay, OneTime, OneWayToSource.


TransformScaleBinder

Binds the scale, Transform.localScale (Vector3). A number (INumberBinder) is applied as a uniform scale on all three axes.

Modes: OneWay, OneTime, OneWayToSource.

[ViewModel]
public partial class UIElementViewModel
{
[OneWayBind] private Vector3 _scale;
}

Switcher variants

Every binder has a Switcher variant (bool → one of two values):

BinderDescription
TransformPositionSwitcherBinderboolVector3 position
TransformRotationSwitcherBinderboolQuaternion rotation
TransformEulerAnglesSwitcherBinderboolVector3 Euler angles
TransformScaleSwitcherBinderboolVector3 scale

TransformParentBinder and TransformSiblingIndexBinder

BinderData typeDescription
TransformParentBinderTransformTransform.parent; local position and rotation are kept, null detaches to the scene root
TransformSiblingIndexBinderintIndex among siblings, clamped to the existing range

RectTransform

RectTransformAnchoredPositionBinder

Binds RectTransform.anchoredPosition / anchoredPosition3D (Vector3, chosen through _space).

Modes: OneWay, OneTime, OneWayToSource.


RectTransformSizeDeltaBinder

Binds RectTransform.sizeDelta (Vector3, axes chosen through SizeDeltaMode). In OneWayToSource the size is handed out both as Vector3 and as Vector2.

Modes: OneWay, OneTime, OneWayToSource.


RectTransform Switcher variants

BinderDescription
RectTransformAnchoredPositionSwitcherBinderboolVector3 position
RectTransformSizeDeltaSwitcherBinderboolVector3 size

Other RectTransform binders

BinderData typeProperty
RectTransformAnchorMinBinderVector2anchorMin
RectTransformAnchorMaxBinderVector2anchorMax
RectTransformOffsetMinBinderVector2offsetMin
RectTransformOffsetMaxBinderVector2offsetMax
RectTransformPivotBinderVector2pivot

All write finite values only; NaN and infinity are logged and skipped.

AnchorMin, AnchorMax and Pivot have Switcher, Enum and EnumGroup variants (RectTransformPivotSwitcherBinder, RectTransformPivotEnumMonoBinder, …).


See also