In this lesson, you will learn how to leverage Unreal Engine’s built-in visual debugging tools to diagnose why your AI is failing to "see" targets or calculate valid paths in real-time.
When an AI acts unexpectedly—like ignoring a player or getting stuck—the issue often lies in a disconnect between the perception system's sensory input and the navigation system's spatial constraints. Rather than guessing, we use the Visual Logger and the AI Debugger to visualize the "thought process" of your agent.
The AI Debugger (')
By pressing the apostrophe key (') while in a PIE (Play in Editor) session, you trigger the AI Debugger. This tool is essential for monitoring sensory stimuli. You can cycle through AI agents using the tab key to see:
- Perception: Watch the "Senses" tab to see if a stimulus (like Sight or Hearing) is currently active. If a player is standing right in front of the AI but the "Sight" sensor isn't reporting a value, you know the issue is in your
AIPerceptionComponentconfiguration or the actor'sTeam IDsettings. - Navigation: The "NavMesh" view shows exactly what the AI sees as walkable space. If your AI stops moving at a doorway, toggling
Show Navigation(PressP) allows you to verify if the mesh is actually generated there or if a dynamic obstacle is blocking the path.
Visualizing Path Queries
Sometimes the AI can see the target, but the navigation query fails. You can visualize these requests by using the console command ai.debug.navigation 1. This draws lines representing the current pathfinding query. If the path appears as a straight line to a point but the AI isn't moving, you are likely looking at a collision or acceleration issue rather than a navigation fault.
If you are writing custom navigation logic, you can print the result of your path requests directly to the log to confirm if MoveTo is returning PathFollowingResult::Aborted or PathFollowingResult::Success:
// Example of logging navigation status in your AI Controller
void AMyAIController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result)
{
UE_LOG(LogTemp, Warning, TEXT("Path Result: %s"), *Result.GetDescription());
}
Key Takeaway: Use the AI Debugger (' key) to verify sensory stimuli registration and the Visual Logger to confirm if navigation failures are caused by blocked geometry or logic errors in your pathfinding requests.