I was following this tutorial to help create some AI pathfinding using C++, and despite the tutorial being made in UE4 and my project using UE5.4, it has been the only tutorial I have found helpful for what I want to do so I decided to go with it. The tutorial was quite helpful until I reached a part of the video where I assume the person used a feature that is no longer available in UE5 and I am having trouble making it work.
void AAIEnemyController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result)
{
AAICharacter* EnemyAI = Cast<AAICharacter>(GetControlledPawn());
//Checks if cast was successful
if (EnemyAI)
{
//Calls the function to pathfind
EnemyAI->MoveToWaypoints();
}
}
The error comes from the line GetControlledPawn, which seems not to exist in UE5 anymore.
I am very new at UE and C++ so any help would be appreciated.