RealDocs

UKismetMathLibrary::Set2D

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Sets the X and Y components of an existing FVector2D variable in place. The primary purpose is Blueprint, where struct variables cannot be set component-by-component without this helper.

Caveats & Gotchas

  • This function mutates A via a ref parameter — it does not return a new vector. In C++ you can set components directly (A.X = ...; A.Y = ...;) which is clearer and avoids a function call overhead.
  • UPARAM(ref) in Blueprint means A must be a variable (not a literal or inline value). Wiring a non-variable pin to the A input will cause a Blueprint compile error.

Signature

static UE_INL_API void Set2D(UPARAM(ref) FVector2D& A, double X, double Y);

Parameters

Name Type Description Default
A FVector2D& The vector to modify in place.
X double New X component value.
Y double New Y component value.

Return Type

void

Example

Reset a velocity vector in Blueprint-exposed code C++
FVector2D Velocity(100.f, 50.f);
UKismetMathLibrary::Set2D(Velocity, 0.0, 0.0);
// Velocity is now (0, 0)

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.