ACharacter::PostInitializeComponents
#include "GameFramework/Character.h"
Access: public
Specifiers: virtualoverride
Description
Called after all components have been initialized. ACharacter uses this to wire the mesh and movement component together and cache the initial mesh offset from the capsule.
Caveats & Gotchas
- • Always call Super::PostInitializeComponents() — skipping it prevents CharacterMovementComponent from registering with the mesh, breaking animation-driven movement.
- • This fires before BeginPlay and before the actor is possessed, so bIsPlayerControlled and the Controller pointer are not yet reliable here.
Signature
virtual void PostInitializeComponents() override Return Type
void Example
Cache a component reference early C++
void AMyCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents(); // REQUIRED
// Components are initialized — safe to query them
MyCustomComp = FindComponentByClass<UMyCustomComponent>();
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?