RealDocs

UKismetMathLibrary::FClamp

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

Description

Returns Value clamped to the range [Min, Max] inclusive. The Blueprint node defaults show 0.0–1.0 but any range is valid.

Caveats & Gotchas

  • If Min > Max the behavior is undefined (FMath::Clamp asserts in Debug builds) — always ensure Min <= Max before calling.
  • The Blueprint node metadata sets default display values of 0..1, which can mislead users into thinking this is alpha-only — the actual range accepted is any valid double.

Signature

static UE_INL_API double FClamp(double Value, double Min, double Max);

Parameters

Name Type Description Default
Value double The value to clamp.
Min double Lower bound (inclusive).
Max double Upper bound (inclusive).

Return Type

double

Example

Clamp normalized alpha C++
float Alpha = SomeRawValue / MaxValue;
Alpha = UKismetMathLibrary::FClamp(Alpha, 0.0f, 1.0f);

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.