UActorComponent::HasBegunPlay
#include "Components/ActorComponent.h"
Access: public
Specifiers: inline
Description
Returns true after BeginPlay has been called on this component and before EndPlay has been called. The canonical way to check whether the component is in the active gameplay phase.
Caveats & Gotchas
- • Returns false during InitializeComponent and even during the actor's BeginPlay if your component's own BeginPlay has not fired yet — the order depends on component registration order.
- • On network clients, a component can receive RPCs before HasBegunPlay() is true if an RPC is called from within BeginPlay of another component or actor; do not use this flag as an RPC guard without additional checks.
Signature
bool HasBegunPlay() const { return bHasBegunPlay; } Return Type
bool Example
Guarding logic that requires active gameplay C++
void UMyComponent::OnSomeEvent()
{
if (!HasBegunPlay())
{
return; // ignore events fired before gameplay starts
}
HandleEvent();
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?