RealDocs

UKismetMathLibrary::SelectColor

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

Description

Returns A if bPickA is true, otherwise returns B. Selects between two linear colours without a branch node, suitable for material parameter or UI tinting logic.

Caveats & Gotchas

  • Works with FLinearColor (HDR, linear space), not FColor (8-bit sRGB). If you need to select between FColor values, convert to FLinearColor first or use a ternary in C++.
  • Alpha is included in the selection — both RGB and A components of the chosen colour are returned as-is with no clamping.

Signature

static UE_INL_API FLinearColor SelectColor(FLinearColor A, FLinearColor B, bool bPickA)

Parameters

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

Return Type

FLinearColor

Example

Toggle highlight colour C++
FLinearColor Tint = UKismetMathLibrary::SelectColor(FLinearColor::Yellow, FLinearColor::White, bIsSelected);
MeshComponent->SetVectorParameterValueOnMaterials(TEXT("Tint"), FVector(Tint));

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.