RealDocs

UKismetMathLibrary::Vector_Assign

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

Description

Copies all components from InVector into A, overwriting A in place. Equivalent to the C++ assignment operator A = InVector.

Caveats & Gotchas

  • In C++, this function is never preferable over the plain assignment operator (A = InVector). It exists to expose a BlueprintCallable mutation node for UPARAM(ref) variables in Blueprint.
  • In Blueprint, this is a reliable way to update a vector variable that is passed by reference into a function. Using the 'Set Variable' node inside a function with a ref parameter can behave unexpectedly; this node sidesteps that.

Signature

static UE_INL_API void Vector_Assign(UPARAM(ref) FVector& A, const FVector& InVector);

Parameters

Name Type Description Default
A FVector& The vector to overwrite. Passed by reference and modified in place.
InVector const FVector& The source vector whose values are copied into A.

Return Type

void

Example

Overwrite a passed-by-ref vector with a new value C++
FVector MyVec = FVector::ZeroVector;
UKismetMathLibrary::Vector_Assign(MyVec, FVector(100.f, 200.f, 0.f));
// MyVec is now (100, 200, 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.