How to Make a Patrol AI in UE5 Blueprints

The classic guard: walk a route, notice the player, give chase, give up, go back. It’s the gateway into UE5’s AI stack — nav mesh, AI controllers, perception — and a simple Blueprint version teaches all the moving parts.

What it’s made of

Variables

An array of patrol waypoints (Target Point actors or scene components), a CurrentIndex int, ChaseSpeed/PatrolSpeed floats, and a state enum (Patrolling / Chasing / Returning).

Events

AI MoveTo’s completion advances the route; AI Perception’s On Target Perception Updated flips the state to chasing (the perception component must live on the AIController — on the character it never fires; Pawn Sensing’s On See Pawn is the on-pawn alternative); a lost-sight timer sends it back.

The logic

Patrol: AI Move To the waypoint at CurrentIndex; on success, increment with a wrap (index % array length), wait briefly, repeat. Chase: on perception, set state and AI Move To the player actor with ChaseSpeed; while chasing, refresh the target. Lost: after the timer, return to the nearest waypoint and resume. A NavMeshBoundsVolume in the level is the non-negotiable prerequisite.

Key nodes you’ll wire

AI MoveToAI Perception / On Target Perception UpdatedNavMeshBoundsVolume (level setup)Array Get + index wrapSet Timer by EventSwitch on EnumSet Max Walk Speed

The mistake that breaks it

No nav mesh — AI Move To silently fails and the guard stands still. Press P in the editor: green means walkable; no green, no movement.

New to how Blueprint systems fit together? Read the anatomy of a Blueprint system first.

Or skip the wiring — generate it

BlueprintStudio builds this system from a plain-language prompt — the right nodes, exec and data pins wired, defaults set, and the graph compiled to catch errors — then applies it into your open UE5 editor. The prompt is prefilled:

Build “Patrol AI” in BlueprintStudio

Prompt variations to try

Applying into your editor happens through the free Cosindra desktop app (Windows & macOS).

More systems