I am working on my Player Gameplay HUD, and in dealing with UMG and widgets, I am at a loss as how to go about making my widgets and referencing them as there does not seem to be a way to make children, only copies.
I have setup my widgets as such:
Created a widget for just a Progress Bar, so that I can stylize this which any way I like, and anywhere I use it, I can later make changes to it, and it will then update every where it is used.
This widget is then used in 3 other widgets, all using this and 3 other different stylized PBars, except each of these widgets has a different layout depending on the weapon type it is associated with.
Those info layout widgets are then dynamically created at runtime, and added to a parent, generic weapon layout widget, which is also created at runtime and added as child to a parent Sizebox on the player HUD so that I can easily change the layout of the player HUD and the weapon widgets will all update according to which weapons are equipped.
The problem I realize I now have, is getting a reference through that hierarchy, to the PBars, and saving those object references in the Weapon BP (When weapon is spawned and attached to player actor, it creates the widgets associated with it) as a variable so that when the weapon charges or is fired etc., it’s state info can be updated in the widget. I do not want to bind the data, as that would run every tick checking to see if the data has changed.
Hopefully this makes sense? Looking for thoughts on good easy ways of the PBars getting a reference to the orginal Weapon BP Actor so they can set the variables with the self reference.