RealDocs

UKismetMathLibrary::SelectVector

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

Description

Returns A if bPickA is true, otherwise returns B. Provides a branch-free conditional selection of a vector value usable inside Blueprint pure graphs.

Caveats & Gotchas

  • In C++, a plain ternary `bPickA ? A : B` is clearer and cheaper; this function exists primarily for Blueprint's visual scripting where branch nodes add visual noise.
  • Both A and B are always evaluated before the call — there is no short-circuit behaviour, so avoid passing expensive computed vectors as arguments when only one path is needed.

Signature

static UE_INL_API FVector SelectVector(FVector A, FVector B, bool bPickA)

Parameters

Name Type Description Default
A FVector Returned when bPickA is true.
B FVector Returned when bPickA is false.
bPickA bool Selector: true returns A, false returns B.

Return Type

FVector

Example

Select between two target positions C++
FVector TargetPos = UKismetMathLibrary::SelectVector(EnemyLocation, PatrolPoint, bIsChasing);

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.