UKismetMathLibrary::SelectInt
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns A if bPickA is true, otherwise returns B. A concise way to pick between two integer values based on a boolean, avoiding a full branch node in Blueprint or a ternary expression in C++.
Caveats & Gotchas
- • This is a pure node with no execution pin — both A and B are resolved before the selection is made. If either integer is produced by a function with side effects (Blueprint side, function calls with outputs), both are always called regardless of bPickA.
- • In C++, using a ternary (bPickA ? A : B) compiles identically and may be more readable. SelectInt is most useful in Blueprint where pure nodes keep the graph compact.
Signature
static UE_INL_API int32 SelectInt(int32 A, int32 B, bool bPickA); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | int32 | The integer returned when bPickA is true. | — |
| B | int32 | The integer returned when bPickA is false. | — |
| bPickA | bool | Selects A when true, B when false. | — |
Return Type
int32 Example
Select a team size based on difficulty mode C++
int32 EnemyCount = UKismetMathLibrary::SelectInt(10, 5, bHardMode);
SpawnEnemyWave(EnemyCount); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?