Download

What is Game Mode and Player Controller?

Please can someone explain me with an real example , what is Game Mode and Player Controller? How and when to use each one?
Beacuse I read documentation and watched some videos abot it ,and what i really learned is Plyer Contoller “Tells , who controls what” and ‘Game Mode is where you wtite Game Rules’ thats it.
Someone please give some exmples )))

I’m not going to give you the dictionary answer, but what I use these components for.
I use the game mode to set the default classes needed in my level. Also, I use it for global code that can be accessed from any BP class. Almost all BPs can cast to the game mode class.
I use player controller for player logic that can be shared between different pawns/characters. For example, you may have a male, female and robot character. With the player controller, you will be able to drive or possess any of them at any time.
Or if you need to drive a car, you will need to unpossess the player character and possess the vehicle.

When learning the UE framework it helps to super simplify things. Basically to make a simple game you don’t need a proper gamemode or player-controller (they can just be empty ‘property only’ classes). Instead put everything inside the Character (Pawn) class. The reason this works is that Player-Controller camera + inputs are already provided to and directly accessible from Character (Pawn). But to see examples of how these really work in practice take projects apart (see sig).:wink: