Download

[Full Project] Rama's UMG Rebindable Key System, Rebind keys at Runtime!

Hi Rama. Thanks for the plugin, it’s awesome, and I’m really happy to see that you’re still updating it, the new nodes are great.

I found a little mixup in the axis mapping blueprint in the sample project. The mouse axes were switched at one point. Here’s a screenshot:

This pretty much renders the whole system useless in my opinion.
When the end user accidentally binds both Axis to the same key (for example W for both move forward and back), it completely breaks the whole system beyond repair. From that moment on both Axis will show the same scale and there is no way to restore default values for anyone outside of the editor, because as you said you cannot remove or recreate an axis, only change an existing one. If that is broken, there’s nothing you can do to restore it. Until this is fixed this system looks neat but it cannot be used for a finished product it seems.

Thank you a lot Rama! :smiley:

Hey Rama,

i found a little bug on blueprint side of your system, here happen you can’t bind Left Mouse Button because if you click on button it capture the event as a click because the button is still active on rebind, i solved it with a little trick:

  1. Disable the button after the OnClicked event in the VictoryElement

[spoiler]

[/spoiler]

  1. In the widget where you use the VictoryElement re-enable the button into the OnMouseButtonDown and OnKeyDown functions

[spoiler]

[/spoiler]
I hope it help for who have the same issue :slight_smile:

Ah, great idea! I did not think to disable the button after clicking on it the first time, then enabling it after binding so you can bind the LMB, I’ll make sure to give Rama the fix so he can add it to the download wiki page! I also fixed

from -Ross’s post!

There is a little bit of a delay when setting the LMB but all the other ones should work instantly!

–GMC

Dear @Ross, @ZioYuri78, and @gmc,

Wow this is great! Thank you for mentioning these fixes!

And thank you gmc for sending me the new version!

I’ve updated the wiki download link:

Have fun today everyone!

:slight_smile:

Rama

Do I need Victory to use this?

Hi Rama, I’ve imported this to a 4.11 project and it looks like the OnKeyDown function is no longer getting fired. Works fine with mouse clicks and mouse moves, but not with keypress.

Ah my bad. I had to set the IsFocusable flag on the Main_ByRama blueprint.

Hi guys! I am new here and almost newbie in UED4 (I had the experience in the first and second UED at the time, but then abandoned it and forgot almost everything). I started my project a month ago and are actively trying to learn Blueprints. Decided started with the Menu, because what’s a game without the menu?:slight_smile: I did almost all menu options, except for remapping of control buttons on the keyboard and the mouse. Because in the editor there’s no way to create menu buttons remapping for a knowledgeable C++ person… I am greatly surprised by the fact that Epic is still not included in UED’s official system of key mapping. It’s like having an expensive car, but without a rudder. How is this even possible? They position the engine and editor as a tool for creating games from scratch, which can be dealt with by a person who knows nothing in programming. But what about remapping the keys? How can I do this without knowing anything in programming? Why still no Blueprints for this? Searching online, I noticed that a lot of people face this problem. If you do not have a programmer in your team (i’m in my “team” alone) - you can forget about the redefinable keys at your own game?
I found VictoryPlugin from Rama (and it led me here), installed it but do not understand how can I use it - never found the guide. Also I installed Rama’s Example project called ReBindableKeys, but as a newbie I still can’t understand how can I use it. Wherever I found any explanation - still all we are talking about programming… Also I tried to install Rama’s plugin called VictoryEdEngine, but I am not able to make it work in the editor. It says that the engine version is not compatible with the version of the plugin and asks to compile the plugin. The great irony! All my attempts to find a more recent version of this plugin has come to nothing - I now have the most recent version. Guys, please help! Don’t let me die a budding game designer!
Without remapping keys, I don’t even want to think about continuing to work. I’m not using WASD, and understood how much it hurts to not play on your desired keys and unable to reassign them. It will just be a huge shame for me to release the game with such a flaw. What do I do? Is there a solution in my case? I’m too old to learn programming and choose UE4 because of the fact that here you don’t need to be a programmer. But ran into a dead end so sad… Can anyone tell where can I find a manual for a Blueprint for create a system of key mapping without programming? Does it even possible? Or my only option is to buy any ready plugin for that? Many thanks in advance for any help! And please forgive me for my bad English:)

First off, when you say “I’m not using WASD, and understood how much it hurts to not play on your desired keys and unable to reassign them.” I am assuming this is in game controls, not editor controls. These can be manually remapped under Input in Project Settings; however, you cannot change this during runtime, without the plugin, which I will now explain.

I am going to assume you are using UMG from your menu, what you’re going to want to do is, create a button that when clicked on, creates the widget Main by Rama, this is all you need to do, the plugin will do the rest; however, you must first have added Inputs under Projects Settings, or nothing will show up. You will also need to add a button to remove or collapse the widget, it should save the bindings by itself.

There is currently no way to rebind Inputs in blueprints :slight_smile: you must use programming, or Rama’s Plugin. You do not need Rama’s Engine, it comes with a lot of extra stuff, like custom functions and macros. As for the Engine version not being compatible, is that for the VictoryEngine or the Plugin, and are you using Unreal Version 4.11? (That just came out, so Rama most likely has not updated the Plugin or the Enigne) You will need to use an older version of Unreal, or wait for Rama to update. If you are already extensively using 4.11, I can tell Rama to update the plugin, but I don’t know how fast he will be able doing that, since he is quite busy :).

If you need more help on how to use the plugin, just ask and I shall make a more detailed explanation!

Thank you, gmc!!! Of course i am saying about to change keybindings during runtime so other players can change them too. There were some days since my first post and i am was learned more:) But for keybinds and using Rama for that - too difficult way in current situation with that plugin. I choosed to buy already done one from Market (for 25 bucks) and now concentrating on other menus whicj i can do myself and of after watching tutorials. The most difficult of them was Brightness - i found no other way except playing with “Gamma” command:)
Thanks you again for support!

np, and as for the brightness, you might be able to put a post process volume in your level and unbound it, then set the auto exposure level in your menu using BPs (higher = brighter)! But you would have to make sure each level has the volume (if you have different levels)

“Gamma” command works fine. It has 6 stages of brightness (0-5, 2 is default) and this is pretty enough for me.

I’m having issues with the alphabetical ordering thing too.

Is there a way to rebind a key on a specific index of the Axis/Action input by modifying the C++ function?

8439fd698e87a7cd080ce66cc63c7b5bac134d6d.png Just this key for example

Or does anyone have a way to bind on the same axis a keyboard key and a gamepad key ?

I may have fix my problem, i’m sharing here two new function i made to add in your VictoryBPLibrary, they allow you to add axis and action input:

For the Axis :
to add in Header :


UFUNCTION(BlueprintCallable, Category = "Victory Library | Key Rebinding")
		static void AddInputAxis(FName AxisNameToAdd, FKey NewAxisKey, float AxisScale);

and in the cpp :

void UVictoryBPFunctionLibrary::AddInputAxis(FName AxisToAdd, FKey NewAxisKey)
{
	UInputSettings* Settings = GetMutableDefault<UInputSettings>();
	if (!Settings)return;
	FInputAxisKeyMapping AxisAdd = AxisAdd.AxisName = AxisNameToAdd;
	AxisAdd.Key = NewAxisKey;
	AxisAdd.Scale = AxisScale;

	TArray<FInputAxisKeyMapping>&Axi = Settings->AxisMappings;
	Axi.Add(AxisAdd);
	for (TObjectIterator<UPlayerInput> It; It; ++It)
	{
		It->ForceRebuildingKeyMaps(true);
	}
}

For the Action :

Header :


UFUNCTION(BlueprintCallable, Category = "Key Rebinding")
		static void AddInputAction(FName ActionNameToAdd, FKey NewActionKey);


cpp :


void UVictoryBPFunctionLibrary::AddInputAction(FName ActionNameToAdd, FKey NewActionKey)
{
	UInputSettings* Settings = GetMutableDefault<UInputSettings>();
	if (!Settings)return;


	FInputActionKeyMapping ActionAdd = ActionAdd.ActionName = ActionNameToAdd;
	ActionAdd.Key = NewActionKey;

	TArray<FInputActionKeyMapping>&Actio = Settings->ActionMappings;
	Actio.Add(ActionAdd);
	for (TObjectIterator<UPlayerInput> It; It; ++It)
	{
		It->ForceRebuildingKeyMaps(true);
	}


}

769a245d83b5353a47236089308fd7a360d36446.png

Hi Rama ! Great job with your plugin :slight_smile: But I got a problem. Why I can’t have axis and action bindings in the same widget ? When I put them into the same widget via Wrap Box or Widget Switcher, I can only change action key bindings and axis don’t respond to my key pressing. If someone know how to fix, it let me know :o

Thanks for this Rama, awesome job. I have a quick question. On my axis mappings, it dies not pick up the axis, for example, when i set my forward axis, its just gamepad thumb-stick left Up, not the axis. So if i move it down, it picks up : gamepad thumb-stick left down, not gamepad thumb-stick Axis. Any ideas where I am going wrong?

Thanks, Shaun :slight_smile:

Rama, this is great!

Couple things though - your RemoveAxis/RemoveAction functions don’t account for the fact a single key might be bound to several axes/actions and we might want to remove the bindings only on axes/actions specified in struct passed to function. And you really should integrate those AddAxis/AddAction nodes - the whole thing is incomplete without them.