Hey man good and easy tutorial. The only way I got around the problem of the loss of modifiers and triggers was through the c++. In code it is possible to grab a mapping's modifiers and triggers. So rather than using the "unmap action" or "unmap key" calls, I actually manually changed the key first, then re-added the modifiers and triggers. After manually changing it I then called in code "RequestRebuildControlMappingsUsingContext()" which is called in the code whenever you call the bind functions like you do in blueprints. It not only fixes the problem of losing modifiers and triggers, but it also stops the mess of actions going out of order in your context if you care enough about the order of things. Although I did not test it in blueprint spaghetti, all the main functions to call to do this are visible in blueprints.
@eternalstellargames Жыл бұрын
Thank you for the kind words! Hmm I hadn't really thought about what the backend C++ code might look like for it. I'm going to look into this and see if I can replicate what you did. I greatly appreciate the feedback and idea. If I get success with it, I'll make another video over it and test it. Take Care!
@TheIanWigle2 Жыл бұрын
@@eternalstellargames My method is a bit different than yours as I am dynamically adding the widgets into my keybind menu for every registered action and key in the contexts I provide it. However, the main code action is the same in terms of the events called. This code is what's in my OnKeySelected() event when the user chooses which key to select. Note that "widget->mappingIndex" is my way of knowing which dynamic widget I used. Since you have a static menu you can replace that with whatever index you want to get your mapping. TArray modifiers = selectedMappingContext->GetMapping(widget->mappingIndex).Modifiers; TArray triggers = selectedMappingContext->GetMapping(widget->mappingIndex).Triggers; selectedMappingContext->GetMapping(widget->mappingIndex).Key = NewKey.Key; selectedMappingContext->GetMapping(widget->mappingIndex).Modifiers = modifiers; selectedMappingContext->GetMapping(widget->mappingIndex).Triggers = triggers; UEnhancedInputLibrary::RequestRebuildControlMappingsUsingContext(selectedMappingContext.Get(), true); All the function calls that you see here are visible in blueprints as I noted. In blueprints the saved triggers and modifiers would be local variables.