Download

AI Perception update not triggered if player pawn changes

I have two streaming levels under my persistent level, 1 and 2. Each of which has:

  • Two enemies
  • An instance of my player pawn blueprint with auto posses on

Then, I put a breakpoint in my AI controller’s blueprint after my OnTargetPerceptionUpdated (AIPerception) event to get some visibility on when my enemy AI are seeing new things.

Next, I start the game in the viewport, putting me in streaming level 1 and possessing my player pawn. I go near an enemy and immediately see it hit the breakpoint, with my player character as the actor it sees.

Then, I have my game switch to streaming level 2 which possesses my second pawn, and run it in front of my enemy AI there. Nothing. The only hits I’m getting on my breakpoint are when I move between them and they see/stop seeing each other.

I tried the same test starting in streaming level 2 and moving to streaming level 1, same thing.

I tried ejecting from my pawn when the AI couldn’t see it and manually putting a new pawn in front of them - they see and attack it but never stop ignoring the original pawn.

What’s going on here? I’m not sure if it’s the level streaming or the fact that the player has switched pawns or what but it seems like a bug on the surface.

I’m using ue4 4.24.3

In case anyone was wondering - fixed this by sharing a pawn between streaming levels. Used this system’s pawn sharing functionality: Loading Screen System in Blueprints - UE Marketplace