AAIController::SetPathFollowingComponent
#include "AIController.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Replaces the active PathFollowingComponent with a different one. Intended for initialization and setup — not for hot-swapping during active movement.
Caveats & Gotchas
- • The header comment explicitly states this does not transfer path following state. Call it only during initialization or setup, never while a move is in progress.
- • Passing nullptr will leave the controller without a path following component, causing GetMoveStatus, MoveToActor, and related functions to silently do nothing or return stale results.
Signature
void SetPathFollowingComponent(UPathFollowingComponent* NewPFComponent) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewPFComponent | UPathFollowingComponent* | The path following component to assign. Must already be registered as a component on this actor. | — |
Return Type
void Example
Assign a custom path following component at construction C++
AMyAIController::AMyAIController()
{
UMyPathFollowingComponent* CustomPFC =
CreateDefaultSubobject<UMyPathFollowingComponent>(TEXT("MyPFC"));
SetPathFollowingComponent(CustomPFC);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?