UMG Input and Button Question

Hi. I have an inventory grid 4 by 4 with child slot widgets in a grid panel (16 slots). I added a button layer to the slot to allow navigation between the slots with the Game Controller. I have a function override for OnKeyDown and OnMousedown so I can equip and uniequip inventory or drop it etc. If I disable the Button - this code works fine, but I can’t navigate with the controller. If I enable the buttons I can navigate the grid with the controller but when I press FaceButton Bottom the button seems to capture the input and therefore the OnKeydown Override does not play. If I could I’d just add a custom event from the button press to the OnKeydown override function… but as you know you can’t add custom events to the functions… Does anyone know the best practice for using Buttons and OnKey overrides at the same time?

Thanks in advance.

If you want to override a general On Key Down function, try to use On Preview Key Down. This function works for all the children widgets, and On Key down function at the base widget works if the same key is not called at the on preview key down.

That was Brilliant worked like a charm.

Anyone know why it’s called OnPreviewKeyDown? What an oddly worded function I don’t think I would have thought of that without someone telling me about it. Thanks!

Great! sounds great to hear that