UActorComponent::BeginPlay
#include "Components/ActorComponent.h"
Access: protected
Specifiers: virtual
Description
Called when the game starts for this component. Called after the owning actor's BeginPlay. Override to perform initialization that requires the actor to be fully in the world.
Signature
virtual void BeginPlay() Return Type
void Caveats & Gotchas
- • Always call `Super::BeginPlay()` first.
- • Component BeginPlay is called after the owning actor's BeginPlay().
Example
Overriding component BeginPlay C++
void UHealthComponent::BeginPlay()
{
Super::BeginPlay();
CurrentHealth = MaxHealth;
// Safe to call GetOwner() here
} See Also
Tags
Version History
Introduced in: 1.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?