Default Pawn Calss with AI Components


I Want to have a AI controller on my Main character, this is due to the fact that player is not always in control. But it seems like all AI components are shot off as soon as i spawn my character through the GameMode “Default Pawn Class”.

Is there a way to have both player inputs and AI on a Character?

A pawn can only be controlled by one controller at the same time. The Default Pawn Class is the one thats used to spawn a pawn for your PlayerController, so of course the AI cannot be in control, because the actor is possessed immediately after spawning the pawn (it actually would really make no sense to have the AI be in control here).

You could either put no ( =NONE) default pawn and spawn it yourself, or you have to construct some other means to switch the controller.

For example put the AI in control, but whenever you need, you send your input to the actor anyway, using a reference to the pawn without the PlayerController actually being the owner of this said pawn.

Or whenever the control switches, you exchange the controllers for as long as you need

Thanks a lot ! That makes great sens!