RealDocs

UKismetMathLibrary::SelectName

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

Description

Returns A if bPickA is true, otherwise returns B. Used for conditional selection between two FName values, such as choosing a socket name, tag name, or gameplay tag based on runtime state.

Caveats & Gotchas

  • FName comparison is case-insensitive — SelectName("MyTag", "MYTAG", bPickA) will always return the first evaluated FName, which are treated as equal by the name table. However the returned name retains its original capitalisation.
  • Using NAME_None as one of the inputs is valid but frequently causes downstream failures: many engine APIs (GetSocketByName, FindTag, etc.) treat NAME_None as unset and skip the operation silently.

Signature

static UE_INL_API FName SelectName(const FName A, const FName B, bool bPickA);

Parameters

Name Type Description Default
A const FName The name returned when bPickA is true.
B const FName The name returned when bPickA is false.
bPickA bool Selects A when true, B when false.

Return Type

FName

Example

Pick a weapon socket name based on equipped hand C++
FName SocketName = UKismetMathLibrary::SelectName(
    FName("RightHandSocket"),
    FName("LeftHandSocket"),
    bWeaponInRightHand
);
Mesh->AttachToComponent(ArmComp, FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName);

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.