What class is responsible for the initialization of the PlayerController?

Hello guys,

Here is what is bothering me. I really like modularity. As far as I understand in Unreal we achieve modularity by “attaching” Actor Components to Actors. So far so good. There is one thing bothering me with the template projects. For example the Third Person Shooter C++ template. In in we have a player character class derived from ACharacter. If my project name is “MyProject”, this class will be called MyProjectCharacter. In this character we have pointers to UCameraComponent and USpringArmCompoment. I assume that this is done for simplification, but I consider this not to be a good practice. I want loose coupling. In other words I think it’d be better to separate the Camera Logic in a different actor. For example CameraRig class and the MyProjectCharacter wouldn’t even know of the existence of a Camera. What I’d do is create a PlayerController class that is the link between the CameraRig and MyProjectCharacter. It turns out that Unreal Engine has a class PlayerController. I noticed that we can implement our versions of the PlayerController and swap the in the GameMode. So far so good. I also noticed that the PlayerController is an Actor that is spawned when I click play. So my questions are:

  1. Which class creates the PlayerController and who spawns it in the game world. Is it the GameMode class? I couldn’t figure it out.

  2. What do you think of my “architecture”? This is what I have done in several games in Unity. I take single responsibility and loose coupling principles very seriously.

I have noticed that some very serious demo projects like the ShooterGame from the Market Store follow similar guidelines, but the template projects do not.