duplicate user widget button by blueprint

Hey,

So I want to duplicate a current active button in my hud. For example:I now have 1 white button, and with use of a for loop I want that the 1 white button will be duplicated to like 5 white buttons spread acroos my HUD.

Hope you can help me out!

Cheers!

Take a look at this tutorial series:

There is only a very small step to get from this to a dynamic amount of buttons. You basically have to use this grid, set it dynamically (or add a scroll bar) and just add as many fields as you need through a loop.

To break it down real quick: You need a template for your button and positions you want to place it. Ideally a grid system. Then you just spawn in that template as often as you have inventory slots.

I hope this helps.

Cheers.

Whats terrible about this solution and in turn all of unreal is the fact that you have to make it a widget template item just to spawn and edit it. Which then actually interferes with editing the item past that point. All editing then has to be done within that widgets item, so an external actor cant reference ANYTHING inside that widget unless you know exactly what class to cast it to otherwise there is no way to even say “add a child”.

For example I have a template button so that i can dynamically spawn multiples of them, which all works fine so far. The issue is when i want to make a new rack below that when this ones full. I cannot simply duplicate generic rack, which is all that i need. I can spawn a template rack widget i made but since its an entire widget compared to just a rack, i cannot place buttons as a child or really work with it as a horzBox, it acts as a generic widget until i cast it and even then its a widget of this type that just contains a horz box. I could make the rack pre filled with template buttons, but then i’d have to build out the functions of replacing the buttons with my real buttons. which would require multiple more public variables and functions for this new widget to use and for my other objects to have to be aware of.

This has become a lengthy process when all I need is a simple duplicate item function. IF i could copy the generic horz Box then thats all i’d need to start the next row, but nope cant work with new items in blueprints of widgets.

1 Like

These lame issues still exist… I’m officially never suing Unreal again after a few years of thinking it was my development needing to catch up but no, unreal has such dumb development decisions that contradict themselves. I’m happy its easy to explain to people why Unreal is bad engine ESPECIALLY for VR and I can do it with multiple examples including this one.