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"

Local multiplayer: different key bindings for each local player?

Is it possible to define key bindings for each local player? e.g. so that in a local multiplayer game each player can define his own mappings for his gamepad.

Product Version: UE 4.12
more ▼

asked Jul 14 '16 at 09:21 AM in Using UE4

avatar image

115 10 16 24

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

1 answer: sort voted first

To define key bindings for each local Player, u will need to create your own UGameViewportClient derived class and ur own UPlayerController derived class. (My aproach is in C++, as the wiki says it is the only way to do this). In your class derived from UGameViewportClient, add the code specified in the following link https://wiki.unrealengine.com/Local_Multiplayer_Tips wich tells u depending ur gamecontrollers case, the code to add.

Then, create a class derived from UPlayerController as i told you, there u need to override the SetupInputComponent to differentiate each binding for each player id. Declare ir your UPlayerControllerOwnClass.h:

 virtual void SetupInputComponent() override;

And then in ur .cpp file:

     int32 id = GetLocalPlayer()->GetControllerId();
     if (id == 0)
         InputComponent->BindAction("Run_P1", IE_Pressed, this, &AMasterController::Run);
 else if( id == 1)
 InputComponent->BindAction("Run_P2", IE_Pressed, this, &AMasterController::Run);
 void AMasterController::Run()
 //Cast to ur own pawn, actor or character class
     auto pawn = Cast<APawnClass>(this->GetPawn());
     if (pawn)

This will work if you DO NOT override the SetupInputComponent in your Character or pawn class that is handle by the Player.

more ▼

answered Jul 19 '16 at 07:40 PM

avatar image

71 1 4 14

avatar image matfer Jul 29 '16 at 04:26 PM

So there isn't an out-of-the-box way to do this. Thank you for the suggestions.

(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