The OnUnPossess() method of the AAIController class is triggered twice

Steps to Reproduce
  1. Create a blank new c++ project
  2. Create a new AIController C++ class
  3. Create the following method in the header file
    virtual void OnUnPossess() override;
  4. Create the following implementation in the Cpp file.
    void AMyGameAIController::OnUnPossess() 
       UE_LOG(LogTemp, Warning, TEXT("AGameAIController::OnUnPossess()")); 

5. Compile.
6. In the editor, create a Pawn and assign its controller to MyGameAIController
7. Open the Level Blueprint,  Drag an instance of Pawn from the persistent level into the level Blueprint.
8. Drag off the Pawn node and type and select "Destroy Actor" to create a destroy actor node. 
9. Right click on the Event Graph and select input key F event.
10. Connect the Execution pin from the Input Key F event into the Destroy actor call from the pawn.
11. Press PIE, call the logic in the level by pressing F. Observe the Output log.


OnUnPossess() is triggered twice.


OnUnPossess() to be triggered once.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-92282 in the post.

Login to Vote

ComponentUE - AI
Affects Versions4.234.244.25
Target Fix4.26
Fix Commit13687795
Main Commit13983507
CreatedApr 21, 2020
ResolvedJun 16, 2020
UpdatedApr 22, 2022