Download

Adding per-player components to HUD in UMG

One level type in my game will have a variable number of players (held in my GameMode and GameInstance subclasses), and I want to present status information about each of them on the HUD. Since I don’t know the number of players ahead of time, I’d like to use a “foreach” block when the HUD is created to instantiate a new status widget and add it as a child, but I can’t be sure the player data will be constructed when the HUD is constructed. On the other hand, there is no “BeginPlay” event for the HUD which is **** annoying. I have considered putting the script for this in my level blueprint, but don’t know how to get access to the HUD from there, and specifically the VerticalBox which I’ve added to the HUD which is to hold the player status widgets (also made from a blueprint). How do I get these bits to glue together?