x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.,

Product Version: Not Selected
Tags:
more ▼

asked Jul 23 '15 at 01:38 AM in C++ Programming

avatar image

M4dM3ll0n
44 6 9 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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:

 virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

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.

more ▼

answered Jul 23 '15 at 04:10 AM

avatar image

ekcell
21 3 4 6

avatar image caribes Jul 23 '15 at 04:57 AM

child and parent are terms of compositions. thats something very different. In C++ there are used the expression base class and derived class in the context of virtual functions.

avatar image ekcell Jul 23 '15 at 05:04 AM

Yeah, I may have had a few terms messed up. Like you said, by parent I meant base class, and child I meant derived class.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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:

 BaseClassName::function( paramters... ); // addressing base class function absolutely

Substitude this with a more generic expression, (Super = BaseClassName) :

 class MyDerivedClass : BaseClassName
 {
   typedef BaseClassName Super; // always added by UE4 framework
   virtual function( parameters... ) override;
 };
 
 MyDerivedClass::function( parameters... )
 {
     // thats how to be used in C++ native syntax
     // BaseClassName::function( paramters... ); // addressing base class function absolutely

     Super::function( parameters... ); // addressing the base class function in a generic way
 }

Both variants doing absolutely the same, but using Super is simplifing the UE4 generic build stuff a lot.

more ▼

answered Jul 23 '15 at 04:51 AM

avatar image

caribes
31 4 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question