AI Blueprint not possessing pawn

Hi,

We’ve been following the [behavior tree quick start tutorial][1], but we’ve been running into an issue.

We’ve got an “enemy” blueprint that has the capsule component and all the other parts that we want in an enemy that follows the player around.

The Imp[Suffix] things are different flipbooks used to represent different perspectives from which the player observes the enemy character. This is made to achieve a doom-like sprite system. Enemy_Blueprint contains the blueprint scripting necessary to make the flipbook change depending on the player’s view (none of this changes the orientation of the actual capsule), and it also has a rudimentary health mechanic.

Now, on to the issue: you’ll notice that in the “pawn” category on the right of that image, the Auto Possess AI option is set to “Placed in World or Spawned”, and the AI Controller Class is set to “Follower_AI_CON”. Follower_AI_CON is close to Follower_AI_CON in the quick start tutorial linked above ([this][3]). There are two differences.

  1. Instead of event beginplay starting the execution, it’s event onpossess. This was something suggested by another answer to a similar problem.
  2. There’s an IsValid check on the “Get Controlled Pawn” function output to check if we actually are getting a controlled pawn.

With these changes, we were able to pinpoint the issue: there’s no pawn possession taking place. With event onpossess, it never triggers (i.e., no possession is taking place). If we replace onpossess with beginplay, our IsValid tells us that “Get Controlled Pawn” is returning null. So the AI blueprint is actually never set to be the AI controller of the pawn. So the question is, why is this happening? We also tried setting the controller on beginplay within Enemy_Blueprint to the AI controller, but no dice. Also, the behavior tree is naturally never triggered, so our Enemy never follows the player as intended.

I’ll be happy to provide any additional information. Please help! :slight_smile:

Anyone have any idea?

I don’t know why or how, but upon revisiting the issue, it… resolved itself. Seriously, it just started working. Dear people from the future: I’m sorry.

I have the exact same issue with 4.10.
The (BP) controller I used was initially derived from AIController and the OnPossess event was properly called then (on the server).
After modifying the parent class from AIController to our subclass of APlayerController, the OnPossess event is simply not called anymore.

I am still investigating the issue to determine whether this is an engine bug or an overlook on my side.

Update: check that the parent class of your Blueprint does declare an OnPossess event. In my case, the APlayerController did not, while the AIController does.