RealDocs

APawn::PostInitializeComponents

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Called after all components have been initialized. APawn's implementation calls UpdateNavAgent() to register accurate nav agent properties with the navigation system.

Caveats & Gotchas

  • Always call Super::PostInitializeComponents() or nav agent registration may be skipped, causing the pawn to be invisible to the navigation system.
  • This runs before BeginPlay and before the pawn is possessed. Do not rely on Controller being valid here — use BeginPlay or PossessedBy for controller-dependent initialization.

Signature

virtual void PostInitializeComponents() override;

Return Type

void

Example

Cache component references after initialization C++
void AMyPawn::PostInitializeComponents()
{
	Super::PostInitializeComponents();
	// Components are now fully initialized — safe to cache references
	CachedMesh = FindComponentByClass<USkeletalMeshComponent>();
	check(CachedMesh);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.