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"

Change Key Mappings

I have the following function to change key bindings:

 // just so you know:
 APlayerController* MyController = Cast<APlayerController>(Controller);
 
 bool AMyGameCharacter::SetKeyBinding(FName action, FKey key) {
     for (int32 i = 0; i < MyController->PlayerInput->ActionMappings.Num(); i++) {
         if (MyController->PlayerInput->ActionMappings[i].ActionName == action) {
             MyController->PlayerInput->ActionMappings[i].Key = key;
             return true;
         }
     }
     return false;
 }

But it doesn't seem to work.

Product Version: Not Selected
Tags:
more ▼

asked Aug 17 '15 at 04:34 PM in C++ Programming

avatar image

Karwler
138 10 11 26

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

1 answer: sort voted first

You might have better luck using RemoveActionMapping() and AddActionMapping(). Theoretically, this should probably also be followed up by a call to SaveConfig() and ForceRebuildingKeyMaps(false), but in my experience so far, I've found that the action and axis inputs are not getting saved to the input.ini file in the saved directory. I did find DebugExecBindings getting saved, as part of Engine.PlayerInput, but nothing from AxisConfig or ActionMappings, from Engine.InputSettings.

  bool AMyGameCharacter::SetKeyBinding(FName action, FKey key) {
      for (int32 i = 0; i < MyController->PlayerInput->ActionMappings.Num(); i++) {
          if (MyController->PlayerInput->ActionMappings[i].ActionName == action) {
              FInputActionKeyMapping actionMap =
                  MyController->PlayerInput->ActionMappings[i];
              MyController->PlayerInput->RemoveActionMapping(actionMap);
              actionMap.Key = key;
              MyController->PlayerInput->AddActionMapping(actionMap);
              return true;
          }
      }
      return false;
  }
more ▼

answered Nov 21 '15 at 06:00 AM

avatar image

JMcComb
71 1 4 9

(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