Home / Guides / Stealth AI in Unreal Engine: How Sight Detection and Alert States Work

Stealth AI in Unreal Engine: How Sight Detection and Alert States Work

Good stealth is about information: the player should always understand why an enemy noticed them. Unreal's AI Perception gives you the raw senses; the design lives in what you build on top.

1. Use AI Perception for the senses

Add an AI Perception component to the AI controller and configure the Sight sense: sight radius, lose-sight radius (a little larger, so enemies do not flicker), and the peripheral vision half-angle that defines the cone. Set which affiliations can be detected and how long a stimulus is remembered (max age).

2. Detection is not a boolean

"Seen" or "not seen" feels harsh. Instead, build up awareness from 0 to 1 while the player is visible, faster when close or in the centre of the cone, and let it decay when the player is lost. Two clear tiers work well: suspicious (the enemy investigates) and alerted (the enemy chases).

3. Drive behaviour from the alert level

Store the alert level, the target and the last known location on the Blackboard, and let a Behavior Tree (or State Tree) pick the branch: patrol, investigate, chase, search. Keep the numbers in one place so designers can tune them.

4. Tell the player what is happening

A screen-space indicator that points toward the enemy who is detecting you is the single biggest readability win. Compute the angle between the camera's forward vector and the direction to the enemy, then rotate a HUD arc by that angle. Change its colour between the two tiers.

5. Losing the player

Do not drop the alert the instant the player breaks line of sight. A short, retriggerable cooldown (a few seconds) followed by a search at the last known location feels fair and gives the player room to hide.

6. Multiplayer notes

AI controllers only exist on the server, so perception and alert logic run there. Replicate the alert state (or just the angle and tier) to the affected player so that their HUD can react. Never trust a client to report that it was seen.

7. Debugging

Use the Gameplay Debugger (the apostrophe key in the editor) to see the sight cone and perceived actors, and the showdebug AI console command for live values.

Want a working base?

My Advanced AI Sight Detection System is a Blueprint framework with server-authoritative replication, a 360-degree directional HUD indicator and a two-tier alert (white warning, then red detection). The Simple Hide system adds hiding spots for the player. Both are below.

Related products

Tools that apply this

Need this built for your project?

I take on custom Unreal Engine, Unity and Blender work.

Request custom work