How to change the position of the button elements at runtime ???

I’m using the virtual joystick to make the controls work:

But now, I want the players to be able to change the control elements’ position at runtime and save them using blueprints. Does anyone have any idea about this? Please help me.

Hello if you want a customisable HUD feature for players; you need couple of UI architecture setup. (maybe you already have)

  1. HUD Child widgets : Make sure every child widget is contained in HUD. Like if you move ammo slot, everything related to ammo slot is moved together under a widget. In short everything in HUD is child widget.
  2. HUD Editor Widget : Have a HUDEditor widget that can handle drag and drop operations of these widgets in viewport. Move around etc. You can make a grid system too for snapping or just leave it free in viewport dimensions. Player opens this from settings menu.. upon construct it replicates every element on the hud into hudeditor with its positions as drag drop buttons.
  3. HUD State - Save Game : Upon edit finish you need to save each element as TMap (WidgetID , Position, Scale, Rotation etc..) You can have an event here also as HUDStateUpdated.
  4. HUD Itself : OnConstruct also OnHUDStateUpdated, get WidgetData from SaveSystem ->ForEach->FindWidgetInChildWidgets->SetPosition. Depending on your architecture you can also remove all child and create all again if UI Architecture is setup with that in mind for each individual widget.

If you want some more explanation interms of how to create this sub system, or how to make a grid system and detect overlaps etc, just let me know. It feels like a lot of job, but if direction was this from the begining and architecture for controllers is setup that way, it is fairly simple to implement.

Happy developing, your game looks nice.