Making the AI chase the player
Now that we have a patrol behavior established, we should make the enemy pose some threat to the player. To do so, we will give the enemy the ability to see the player and pursue them.
Giving the enemy sight with Pawn Sensing
To grant the enemy the ability to detect the player, we need to add a PawnSensing
component to the EnemyController
. To do this, open the EnemyController Blueprint and click on the Add Component button in the Components panel. Search for and add the PawnSensing component. This component gives us the ability to add a few additional event triggers to the EnemyController
event graph. The one we are interested in now is called OnSeePawn (PawnSensing), as shown here:

Note
There is a second system that can be used for AI behavior development and environment sensing called the Environment Query System (EQS). As of Unreal Engine version 4.7.6, this feature is still in the experimental development phase and has some bugs that prevent it from being recommended...