Implementing blinking light in C++

You were pretty close :slight_smile:

You may need to adjust the max value depending on the units you measure the intensity in.

Add include to the cpp file

#include "Kismet/KismetMathLibrary.h"


void UBlinkerCpp::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	UKismetMathLibrary::FMod(m_ProgressTime + DeltaTime, m_PulseRate, m_ProgressTime);	
	m_ProgressAlpha = m_ProgressTime / m_PulseRate;
	float multiply = m_ProgressAlpha * 360.0f;
	float sinResult = UKismetMathLibrary::DegSin(multiply);
	
	float result = FMath::GetMappedRangeValueClamped(FVector2f(-1.0f, 1.0f), FVector2f(m_MinLightIntensity, m_MaxLightIntensity), sinResult);

	if (UPointLightComponent* light = GetOwner()->FindComponentByClass<UPointLightComponent>())
	{
		light->SetIntensity(result);
	}
}