UKismetMathLibrary::Conv_IntToBool
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureBlueprintAutocast
Description
Converts an integer to a boolean: 0 maps to false, any other value maps to true.
Caveats & Gotchas
- • Any non-zero value — including negative numbers — returns true. This mirrors C++ implicit bool conversion, but can produce unexpected results if you assumed only 1 means true (e.g. bitmask fields where multiple bits are set).
- • As a BlueprintAutocast this fires silently when an Integer pin is connected to a Boolean pin. Consider whether a comparison node (== 0, != 0) is more readable and self-documenting in Blueprint graphs.
Signature
static UE_INL_API bool Conv_IntToBool(int32 InInt) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InInt | int32 | The integer to interpret as a boolean. | — |
Return Type
bool Example
Reading a flag stored as an integer C++
int32 FlagValue = GetFlagFromSaveGame(); // 0 or 1 stored in save
bool bIsEnabled = UKismetMathLibrary::Conv_IntToBool(FlagValue);
if (bIsEnabled) { /* ... */ } See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?