UKismetMathLibrary::Conv_BoolToDouble
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureBlueprintAutocast
Description
Converts a boolean to a double: false returns 0.0, true returns 1.0. Useful for blending, scaling, or enabling smooth transitions driven by a boolean flag.
Caveats & Gotchas
- • Returns exactly 0.0 or 1.0 — not a continuous value. For smooth transitions (0.0→1.0 over time) use a timeline or FMath::FInterpTo driven by the bool, not just a single conversion.
- • The header names this 'To Float (Boolean)' in its DisplayName, reflecting its pre-UE5 history as a float return. The actual return type is double in UE5+.
Signature
static UE_INL_API double Conv_BoolToDouble(bool InBool) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InBool | bool | The boolean value to convert. | — |
Return Type
double Example
Scale damage by an invulnerability flag C++
bool bIsInvulnerable = GetIsInvulnerable();
double DamageScale = 1.0 - UKismetMathLibrary::Conv_BoolToDouble(bIsInvulnerable);
// DamageScale == 0.0 when invulnerable, 1.0 otherwise
ApplyDamage(BaseDamage * DamageScale); Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?