Widget Blueprint HUD Duplicated On Begin Play

I’m using a Widget Blueprint for my in-game HUD, but when creating it in a multiplayer match it gets duplicated. I print out “Created HUD” within On Begin, which is printed out multiple times per client, and I also print out “Set Character” within the actual Widget, when I’m getting a handle to the character, which prints out negative clients.

This is what my HUD looks like within the editor, using 9:99 as placeholder text.

44534-default.png

And within a MP game, it gets overlapped by a second HUD, and only updates the newest one.

44533-timer.png

Here is my blueprint in FirstPersonCharacter that simply sets up the widget.

With dedicated server:

FirstPersonCharacter Blueprint

LogBlueprintUserMessages: Client 1: Created HUD
LogBlueprintUserMessages: Client 1: Created HUD
LogBlueprintUserMessages: Client 2: Created HUD
LogBlueprintUserMessages: Client 2: Created HUD
LogBlueprintUserMessages: Client -2: Set Character
LogBlueprintUserMessages: Client -2: Set Character
LogBlueprintUserMessages: Client -2: Set Character
LogBlueprintUserMessages: Client -2: Set Character

With listen server:

LogBlueprintUserMessages: Server: Created HUD
LogNet: Join succeeded: 361
LogBlueprintUserMessages: Server: Set Character
LogBlueprintUserMessages: Client 1: Created HUD
LogBlueprintUserMessages: Client 1: Created HUD
LogBlueprintUserMessages: Client -2: Set Character
LogBlueprintUserMessages: Client -2: Set Character

Did you ever figure this one out? I’m experiencing the same issue.

BeginPlay is called on every PlayerCharacter in the Game. If you have a MultiplayerGame and you have for example 2 players in there, the BeginPlay function will be called twice per Game. One time for the main Player and one time for the replicated version of the enemy.

You want to hook a branch with a simple “IsLocallyControlled” in front of you widget things, then it will not be called on the replicated player, but only on the one that the player really controlls.

1 Like

Great answer. Thanks eXi!

Thanks Exi also you can use the HUD class because thats what its meant for :slight_smile: