UActorComponent::BeginPlay
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtual
Description
Called when gameplay begins for this component, either when the owning actor begins play or immediately after the component is created if the actor has already begun play. Requires the component to be registered and initialized.
Caveats & Gotchas
- • Always call Super::BeginPlay() — the base implementation sets bHasBegunPlay and fires ReceiveBeginPlay (the Blueprint event). Omitting Super means Blueprint overrides will never execute.
- • BeginPlay fires per-component, not just per-actor. If you add a component dynamically to an actor that has already begun play, BeginPlay is called immediately on attachment.
Signature
ENGINE_API virtual void BeginPlay() Return Type
void Example
Standard component BeginPlay override C++
void UMyComponent::BeginPlay()
{
Super::BeginPlay(); // Must call Super — sets bHasBegunPlay and fires Blueprint event
// Subscribe to events or start timers here
GetWorld()->GetTimerManager().SetTimer(MyTimerHandle, this, &UMyComponent::OnTimer, 1.0f, true);
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?