UKismetMathLibrary::LinearColor_SetRGBA
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Sets a LinearColor variable's individual R, G, B, and A channels from separate float values. Useful in Blueprint when you want to build a color from computed component values without constructing a temporary.
Caveats & Gotchas
- • Values are in linear space, not sRGB. A value of 0.5 is not perceptually mid-grey — it corresponds to roughly 73% perceived brightness on a standard gamma-2.2 display. Use LinearColor_SetFromSRGB if your source values are sRGB.
- • Alpha defaults to 1.0 in C++ but the Blueprint node exposes it as a required pin — there is no default wiring in Blueprints, so leaving it unconnected will use 0.0, not 1.0.
Signature
static UE_INL_API void LinearColor_SetRGBA(UPARAM(ref) FLinearColor& InOutColor, float R, float G, float B, float A = 1.0f) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InOutColor | FLinearColor& | The color variable to overwrite in-place. | — |
| R | float | Red channel value in linear space (0.0–1.0 typical, but can exceed 1 for HDR). | — |
| G | float | Green channel value in linear space. | — |
| B | float | Blue channel value in linear space. | — |
| A | float | Alpha channel value. | 1.0f |
Return Type
void Example
Set a color to a custom orange C++
FLinearColor MyColor;
UKismetMathLibrary::LinearColor_SetRGBA(MyColor, 1.0f, 0.45f, 0.0f, 1.0f);
// MyColor = linear orange, full opacity See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?