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
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 tells you whether it is ready to paste or what to set up first. The prompt is prefilled:
Build “Patrol AI” in BlueprintStudioPrompt variations to try
Paste it into your Blueprint, or apply it with the free Cosindra desktop app (Windows & macOS).
Common questions
The nav mesh is green but my AI still won’t move — why?
AI Move To needs a possessing AIController, and a character dragged into the level doesn’t get one by default. On the character’s defaults, set Auto Possess AI to Placed in World or Spawned. Also check the acceptance radius — a radius of 0 against a waypoint the capsule can’t perfectly reach leaves the move permanently in progress, which looks identical to standing still.
How do I make the AI give up a chase and return to patrol?
On Target Perception Updated fires with Successfully Sensed false when sight is lost — don’t give up instantly there. Start a one-shot Set Timer by Event as the give-up window; if perception fires true again, Clear and Invalidate Timer by Handle cancels it. Only when the timer actually expires do you flip the enum to Returning and AI Move To the nearest waypoint.
Do I need a Behavior Tree for patrol AI?
For patrol-chase-return, a Switch on Enum in the AIController is honestly easier to build and debug than a Behavior Tree. Trees earn their setup cost when states multiply — investigate, take cover, call reinforcements — because Blackboard keys and decorators keep that growth from becoming spaghetti. Nothing is wasted either way: the perception setup and move logic transfer straight across.