RealDocs

UKismetMathLibrary::LinearColor_ToNewOpacity

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

Description

Returns a copy of InColor with the alpha channel replaced by InOpacity, leaving R, G, B unchanged.

Caveats & Gotchas

  • Does not clamp InOpacity — passing values outside [0,1] produces a color with an out-of-range alpha, which may cause unexpected blending results in materials.
  • Returns a new FLinearColor by value; the original color is not modified.

Signature

static UE_INL_API FLinearColor LinearColor_ToNewOpacity(FLinearColor InColor, float InOpacity);

Parameters

Name Type Description Default
InColor FLinearColor Source color whose RGB channels are preserved.
InOpacity float New alpha value to assign.

Return Type

FLinearColor

Example

Fade a color to semi-transparent C++
FLinearColor BaseColor = FLinearColor::Red;
FLinearColor FadedColor = UKismetMathLibrary::LinearColor_ToNewOpacity(BaseColor, 0.5f);
// FadedColor is (1,0,0,0.5)

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.