Do you know why this code is run twice?
void ADoor::BeginPlay()
{
Super::BeginPlay();
UpdateFunctionFloat.BindDynamic(this, &ADoor::UpdateTimelineComp);
if (DoorTimelineFloatCurve)
{
UE_LOG(LogTemp, Warning, TEXT("[ ADoor::BeginPlay() ] : AddInterpFloat"));
DoorTimelineComp->AddInterpFloat(DoorTimelineFloatCurve, UpdateFunctionFloat);
}
if (DoorLever)
{
UDoorInteractionComponent* InteractionComp =
DoorLever->FindComponentByClass<UDoorInteractionComponent>();
if (InteractionComp)
{
UE_LOG(LogTemp, Warning, TEXT("[ ADoor::BeginPlay() ] : Get Interaction Component"));
InteractionComp->OnInteraction.BindUObject(this, &ADoor::HandleOnInteraction);
}
}
}
I get this on the Output log:
LogTemp: Warning: [ ADoor::BeginPlay() ] : AddInterpFloat
LogTemp: Warning: [ ADoor::BeginPlay() ] : Get Interaction Component
LogTemp: Warning: [ ADoor::BeginPlay() ] : Get Interaction Component
The UDoorInteractionComponent
is:
UDoorInteractionComponent : public UActorComponent