RealDocs

APawn::PostRegisterAllComponents

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

Description

Called after all components have been registered, but before BeginPlay. APawn overrides this to call UpdateNavAgent() so the navigation system receives accurate capsule size data.

Caveats & Gotchas

  • Always call Super::PostRegisterAllComponents() or the nav agent properties will not be updated, causing incorrect pathfinding for AI-controlled pawns.
  • This is called both in-editor and at runtime when the actor is added to the world, so code here may run in editor contexts where the game loop is not active.

Signature

virtual void PostRegisterAllComponents() override;

Return Type

void

Example

Override to finalize component-dependent setup C++
void AMyPawn::PostRegisterAllComponents()
{
	Super::PostRegisterAllComponents();
	// All components are now registered — safe to query them
	if (USkeletalMeshComponent* Mesh = GetMesh())
	{
		Mesh->SetAnimationMode(EAnimationMode::AnimationBlueprint);
	}
}

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.