AAIController* UAIBlueprintHelperLibrary::GetAIController(AActor* ControlledActor) { APawn* AsPawn = Cast<APawn>(ControlledActor); if (AsPawn != nullptr) { return Cast<AAIController>(AsPawn->GetController()); } return Cast<AAIController>(ControlledActor); }