Unreal Engine 5 · Blueprint → C++
Sign in Unreal Engine 5 C++UE Docs
The Sign Blueprint node returns the sign of a number. In C++ the equivalent is FMath::Sign(Value), which returns -1, 0, or 1.
Blueprint node & C++ equivalent
float Sign = FMath::Sign(Value); // -1, 0, or 1What does the Sign node do?
Sign reports whether a value is negative, zero, or positive. It returns -1 for negative inputs, 0 when the value is exactly zero, and 1 for positive inputs.
It is commonly used to extract direction from a delta, for example to know which way to move without caring about magnitude.
The C++ equivalent
Use the templated FMath::Sign(Value). It works with float, double, and integer types, returning a value of the same type as the input: float Sign = FMath::Sign(Value);.
Because it is templated, calling FMath::Sign(-3.7f) returns -1.0f and FMath::Sign(42) returns 1, so the result type follows your argument.
Common mistakes
Do not confuse FMath::Sign with FMath::Abs. Abs strips the sign and keeps magnitude, while Sign discards magnitude and keeps only direction. Multiplying the two reconstructs the original value: FMath::Abs(V) * FMath::Sign(V) == V.
Also remember that exactly zero returns 0, not 1, which matters if you assume the result is always non-zero before dividing by it.
Frequently asked questions
What does FMath::Sign return in UE5?+
It returns -1 for negative values, 0 for exactly zero, and 1 for positive values, using the same numeric type as the input argument.
Does FMath::Sign work with integers?+
Yes. FMath::Sign is templated, so it works with int32, float, and double and returns a result of the same type as the value you pass in.