AAIController::PostRegisterAllComponents
#include "AIController.h"
Access: public
Specifiers: virtualoverride
Description
Called after all components have been registered with the world. The AIController override caches the UGameplayTasksComponent reference used by the Gameplay Tasks system.
Caveats & Gotchas
- • This fires before BeginPlay — components are registered but the world has not ticked. Do not access world subsystems or other actors' state here; they may not yet be initialized.
- • Always call Super::PostRegisterAllComponents() when overriding. Skipping it leaves CachedGameplayTasksComponent null, breaking all GetGameplayTasksComponent() calls and causing Gameplay Tasks to silently fail.
Signature
virtual void PostRegisterAllComponents() override Return Type
void Example
Cache a custom component reference after registration C++
void AMyAIController::PostRegisterAllComponents()
{
Super::PostRegisterAllComponents();
// FindComponentByClass is safe here — all components are registered
MyCustomComp = FindComponentByClass<UMyCustomAIComponent>();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?