UActorComponent::HasBeenInitialized
#include "Components/ActorComponent.h"
Access: public
Specifiers: inline
Description
Returns true after InitializeComponent has been called and before UninitializeComponent has been called. Reliable indicator that the component's gameplay subsystems are ready.
Caveats & Gotchas
- • Only returns true when the component has bWantsInitializeComponent set to true AND InitializeComponent has already executed; components with bWantsInitializeComponent == false will never flip this flag.
- • UninitializeComponent is called inside AActor::EndPlay before the component is destroyed, so this can return false while the component object still exists — guard any EndPlay logic accordingly.
Signature
bool HasBeenInitialized() const { return bHasBeenInitialized; } Return Type
bool Example
Checking initialization before calling subsystem APIs C++
void UMyGameComponent::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (!HasBeenInitialized())
{
return; // subsystems not ready yet
}
UpdateInternalState();
} Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?