AI stops working after being Unpossessed by the PlayerController

I’m trying to implement a character switching system where I can switch player control between two characters. When I’m controlling one character, the other character is controlled by AI. The switching works perfectly, however, after I possess a character previously controlled by AI and then unpossess it (it goes back to being controlled by AI), the AI stops working i.e. it stops performing anything in the Behaviour Tree.

Here are the blueprints I use to switch characters, which are inside of my PlayerController blueprint:

Here are the blueprints for each of the two characters (“ThirdPersonCharacter1” and “ThirdPersonCharacter2”) I am using to handle AI repossession.

ThirdPersonCharacter1:

ThirsPersonCharacter2:

I have also attached a Text above each of the characters heads that will display the name of the controller that is currently attached to it (either PlayerController or AIController), and I can verify that the AI Controller is indeed attached after I possess and unpossess the character:

320623-image-4.jpg

I have been at this for a long while now and I can’t figure out if there is something I have to do to reactivate an AIController after it was previously displaced by a PlayerController. Does anyone have experience with this and can help me resolve this issue?

Thank you!

Hi! And where is the code to Run BehaviourTree? Do you run it after posessing?

I just found the function “Run Behaviour Tree” and attached it to the end of my Possess by AI Controller function like so:

Now it works perfectly! Thank you!