Logic inside the game mode / HUD / Widget

Hello.

I look different video on how to manage key and widget. And some of them make the logic inside the widget itself with the overwrite of the “On Key Pressed” function.

But I’m wondering if it’s the best place to handle all the logic of the keyboard?

I want to create a main menu (Menu before the game), so i have create a menu game mode. I was wondering if my game mode should only display the widget on the screen, or if my game mode should handle all the input key pressed and show correct widget according to. Or if I have to create a main widget where i display different widget on it, but the main logic is inside that main widget?

What do you think it’s the best approach?? Maybe there is another best approach to do that?

Thanks for your time.

Handling something like this in a widget is fine.

Unless your menu IS a 3d level.

No my menu it’s just 2D images, with different button and animation.
But because i create a menu without “Mouse” I would like to make it work on console like PS4, Nintendo as well. So i have to create a menu without mouse, and it’s like i have to create a kind of logic according the key i press.

Maybe i’m wrong about How i need to do it… But for the moment it’s a counter telling me which screen or on which button I am and that counter will before an action (switch screen, animated the “button”, and things like that)

Maybe it’s not the best way to do? But because of that i was wondering who should handle all that logic.

You can make your widget work more like a stack instead of having a counter and mapping each widget to a key.

Stack will work on the basics of FILO(First In last out), you can use push and pop in a simple Array of widgets.

I am not sure if I understand your question correctly but for sake of input I have found this node/Function to be really helpful, it is also present in blueprints.

1 Like