First Person Shooter Tutorial Question

I noticed in the tutorial that it has the setupinput protected but I did not see this protected in ShooterGame and not sure why it would be protected.

FPSCharacter.h

virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) OVERRIDE;

Hi Emile! Thanks for taking a look at the FPS tutorial :slight_smile:

FPSCharacter inherits from the Character class, which inherits from the Pawn class. In the Pawn header file, SetupPlayerInputComponent is also protected. Since it is protected, child classes like FPSCharacter can set up their own input components by overriding the function since they are aware of it. However, you would not usually want other classes to be able to change how the pawn’s input is set up or call the function out of the normal order, so that is why it is protected. Generally, though, whether or not a function is private, protected, or public is up to the programmer and the desired functionality for the game, and this is probably why the SetupPlayerInputComponent in ShooterGame is declared differently. The FPS tutorial is modeled after the Code First Person template from the New Project browser, so you could take a look at that as well as you go through the tutorial.

Thanks!

thank you for responding that makes sense