Hello everyone,
I have a HUD WidgetBP that works perfectly when I play my game in the editor viewport, but when I select “Standalone Game” or when I package the game, it does not show at all.
The way I have it set up is:
In my gamemode the default HUD Class is set to BP_ShipHUD
That BP constructs WBP_HUD on BeginPlay and adds it to the Viewport
There are no errors or even mentions of either BP_ShipHUD or WBP_HUD in the log when I package the game.
Please let me know if there is anything that could be helpful that I didn’t provide
If you are constructing the widget in the game mode that might be the cause of your issue. The game state would probably be a better place to relay information regarding construction of widgets on client viewports, but that may require communication to the player state if different widgets are relevant to specific clients.
It may be the case that while playing in the editor that the editor IS acting as the client and server as well so you’re seeing it there, but playing the packaged game may result in this issue. I can’t say for sure without all the relevant information.
A good way I find to have server authoritative widget creation is to create widgets in a custom event on the game instance and you can run a server event from the game mode to call a server function on the game state and do a multicast and get the player array from the game state and run a For Each Loop and cast to the player state where you can individually call the game instance for said widget function on each player state. Lol.
Or you could just call the widget function from the game instance from the character/pawn or the player controller directly on begin play.