Course contentsShow
← Unreal Engine Game Development
Lesson 464 of 8806. AI, Navigation, and Decision MakingFree lesson

Visualizing AI Perception Data for Debugging

Use the AI debugger and perception visualization tools to track AI sensory ranges and current detection status in real-time.

In this lesson, you will learn how to leverage Unreal Engine’s built-in AI Debugger and Perception visualization tools to inspect sensory ranges and target detection states in real-time.

When debugging AI, the most common frustration is not knowing why an AI sees a player or why it fails to react to a sound. Relying solely on UE_LOG prints is inefficient. Instead, we use the AI Debugger, which provides a spatial representation of your AI's sensory awareness.

Accessing the AI Debugger

While running your game in PIE (Play In Editor), press the ' (apostrophe) key to open the AI Debugger HUD. Once open, pressing Numpad 4 toggles the "Perception" view. This visualizes your AI’s AIPerceptionComponent settings directly in the viewport.

Reading the Visuals

Once the overlay is active, you will see lines and spheres representing the senses configured on your actor:

  • Vision Cones: Solid or wireframe arcs showing the AI's SightRadius and PeripheralVisionAngle.
  • Detection Colors: Lines connecting the AI to an actor will change color based on state: Green typically represents a successfully detected stimulus, Yellow indicates an active stimulus that is currently being processed or is at the edge of awareness, and Red often signifies a lost target or "forgotten" stimulus.

Real-Time Validation

If your AI isn't detecting an object, check the Stimulus Source. Ensure the object you want detected has an AIPerceptionStimuliSourceComponent attached and that it is configured to register for the correct sense (e.g., UAISense_Sight). You can verify this by checking the text readout in the AI Debugger overlay while pointing your camera at the AI; it will list all active stimuli currently stored in the perception memory.

If you need to log specific transitions between these states during complex logic, ensure you are referencing the FActorPerceptionBlueprintInfo structure in your C++ code to inspect the LastSensedStimuli array. This allows you to verify if the "Success" flag is true before your behavior tree logic triggers a transition to an "Attack" state.

Key Takeaway: The AI Debugger’s spatial visualization is the fastest way to verify that your perception ranges, angles, and stimulus registrations are correctly aligned with your gameplay intent.