void FGameplayDebuggerCategory_AI::DrawPawnIcons(UWorld* World, AActor* DebugActor, APawn* SkipPawn, FGameplayDebuggerCanvasContext& CanvasContext) { FString FailsafeIcon = TEXT("/Engine/EngineResources/AICON-Green.AICON-Green"); for (FConstPawnIterator It = World->GetPawnIterator(); It; ++It) { const APawn* ItPawn = *It; if (IsValid(ItPawn) && SkipPawn != ItPawn) { const FVector IconLocation = ItPawn->GetActorLocation() + FVector(0, 0, ItPawn->GetSimpleCollisionHalfHeight()); const AAIController* ItAI = Cast<const AAIController>(ItPawn->GetController()); FString DebugIconPath = IsValid(ItAI) ? ItAI->GetDebugIcon() : FailsafeIcon; if (CanvasContext.IsLocationVisible(IconLocation) && DebugIconPath.Len()) { UTexture2D* IconTexture = (UTexture2D*)StaticLoadObject(UTexture2D::StaticClass(), NULL, *DebugIconPath, NULL, LOAD_NoWarn | LOAD_Quiet, NULL); FCanvasIcon CanvasIcon = UCanvas::MakeIcon(IconTexture); if (CanvasIcon.Texture) { const FVector2D ScreenLoc = CanvasContext.ProjectLocation(IconLocation); const float IconSize = (DebugActor == ItPawn) ? 32.0f : 16.0f; CanvasContext.DrawIcon(FColor::White, CanvasIcon, ScreenLoc.X, ScreenLoc.Y - IconSize, IconSize / CanvasIcon.Texture->GetSurfaceWidth()); } } } } }