How do I Switch from a Player Controller to an AI Controller?

I’m currently working on a feature where the player can switch between 4 different characters that are running AI controllers. Switching to the AI controller and possessing it to take control works fine, but I can’t seem to figure out how to have the previously controlled pawn run the AI controller. Is there another way to have the character use the AI controller instead of just spawning in a new AI in its place?

Ended up figuring it out… I just had to spawn in a default controller for each AI.

could you elaborate? I’m trying to figure out how to do this as well

Probably too late for the person who commented, but one way you can achieve this is probably something like:

Set up an AI controller variable in your actor, then save a reference to it on Begin Play.

Under “Pawn” set a default AI, have the Auto Possess AI set to “placed in world or spawned”, and set up the “Unpossessed” event, which you use to have the AI Controller reference you saved reclaim control of your actor when your player drops possession of that actor.