Download

Having a tough time getting what exactly I need to do for Rama's dynamic key binding.

I have looked at the example that Rama has made and I pretty much get everything but how to capture a key press. I dont understand how to pause everything and wait for the next key press then assign it to a variable I can use. It seems like something that would be super simple but for some reason I am just stuck on this one thing.

Anyone here understand how to do this? Please help.

Hey there,

well the important area for is the overridable inside your widget blueprint.

Within these function you´ll find: (OnKeyDown, OnMouseButtonDown a.s.o).

OnKeyDown for example fires when the widget which implements this function is in focus.

OnMouseButtonDown is exactly the same thing.

So for your workload you can go by doing something like this:

  • I assume you are able to load the Input Mappings and stuff, so i wont care about that here.

  • When you open your menu you see those mappings, and each mapping (“Item”) has a Button which you can click in order to prepare a new “Rebind” of specific input mapping.

  • So when you click that button, there may be a Text Widget show up, telling you “Press a new key” or something and maybe a bool which indicates that it is now possible to call your rebind logic.

  • So you press a key now -> will cause OnKeyDown to fire -> you check your bool from the step above if it is possible to do anything now -> no? do nothing. Yes -> go for your rebind.

Something important may be, not 100% sure, that you need to disable the keyboard focus for your Rebind widget -> Set that up inside you Design Panel -> you´ll find that option in the Details Section somewhere.

Hope that helps for the beginning