can someone tell me what this line of code does, Super::SetupPlayerInputComponent(InputComponent);,Can Someone tell me what this line of code does,
I am trying to use UE4 and I don't know what this does (Super::SetupPlayerInputComponent(InputComponent);) I am trying to set up player inputs for moving but I need to understand the code first. Can Someone please help me.,
asked Jul 23 '15 at 01:38 AM in C++ Programming
Super is used like that when you override a function in a child class but want to make sure all the parent class commands also get run in the same function.
If you have stumbled on this line of code and are wondering what it does then look in the header and you should see:
This means that the class you are deriving from (Lets say APawn) has a virtual function with this same name. It allows you to override this function in your Pawn and change the behavior.
If the base Pawn class were doing something special in this function and you override it without calling super then you would miss out on all the parent pawn were doing.
answered Jul 23 '15 at 04:10 AM
I assume you are familar with C++ classes, virtual functions, vtables. Otherwise check these basics not being specific to UE4.
"Super" is used in UE4 as a generic definition for the name of the base class, the current class is derived from. Thats an approach been copied from java.
With "Super" you can do following:
Substitude this with a more generic expression, (Super = BaseClassName) :
Both variants doing absolutely the same, but using Super is simplifing the UE4 generic build stuff a lot.
Follow this question
Once you sign in you will be able to subscribe for any updates here