How do i spawn and add a UMG widget on the Client?

Hi ! I want to have a User Interface where the player can see his health etc. First i tried setting up the UMG widget in the Begin Play of the Player. This worked fine until i realized that every player gets a UMG widget too. Meaning every player has 2 of the exact same widgets on top of the other. I tried spawning the widgets localy using the Is Local controlled node. This has the result that only the Server got a widget but not the clients. I also tried spawning the widgets in the gamemode blueprint. This dosent work ether because the UserInterface Widget needs a reference to the player. And get owner just returns null on the clients. So what else can i do ? Or am i doing something wrong here ?


Switch Has Authority is connected to the Authority (Server)
Move that Pin to Remote, that way all that stuff will get executed on the client

But how do i get a reference them ? The Player BP needs a refernce to the UserInterface and the Inventory

We first need to talk in the same language, by default, there is no “Player Blueprint”, you might be talking about PlayerController…
Before we can help you further, check this prior getting into Replication, it was very helpful for me:
(The site seems to be down right now, you can check later on)

I don’t know what are you talking about with UserInterface and Inventory, please use the Class names rather than your variable names

Hey Gunschlinger,

I actually hit a similar issue recently when setting up multiplayer. What I found was that I wasn’t calling the ‘Post Login’ event on the correct player controller, which resulted in just the server/no clients receiving the events events.

You have a slightly different Post Login setup (I used a similar setup to the Multiplayer Shootout example project), but I would suggest to make sure you have the correct target reference (E.g. Print the player controller you are calling to right before you call the event) when you make the Post login Event call. You could also use the blueprint debugging tools and possibly put an ‘on key’ event in your player controller to also run the same post login code and see if that works for each client. If that works you now know that it could be the calling function, and can continue to narrow down where the issue is occurring from there.

Spawning the UMG Widgets worked now. The problem is that i need a reference for the player(My Player Character the one you controll in the networked game.). The problem is that i tried to use the “Get Owning Player” and then getting the Player pawn and then casting it to my Player Blueprint. But this only works for the Server

Ok so first:

“EventPostLogin” is in the GameMode Class. The GameMode does not exist on the Client! So the “SwitchHasAuthority” will only be Authority and can be deleted anyway.


UI only exists on Clients and ListenHosts (which are Server and Client). You don’t want a Dedicated Server to have UI.


When you want to display something about the local PlayerCharacter, why not using “GetPlayerCharacter 0”?
“GetOwningPlayer” should also work, since you passed that when creating the Widget. You just need to remember that this is all
happening on the Client. If you just want to get Data about the Players Character (the one sitting on front of the Screen, not the other Players):

Use: GetPlayerCharacter0


GetPlayerCharacter0 worked. Thanks eXi ! If you have any other tips i should know about then let me know.

Well, not really a “tip”, but before hopping into Multiplayer Games, you should really learn the Unreal Network Framework.

It is really important to know which classes exist on which “players” (Client/Server) and what they are meant for.
While it’s relatively easy to use all these classes for a singleplayer game, it is way harder to create a multiplayer game without

Check this site to understand more about networking: Unreal Framework & Network - Nuno Afonso

Also, you need to know about ownership. It’s pretty important to know how the ownership works and what you need to consider.

An example, which i always hit myself with, is: When the Server Spawns an actor… or better, when you place a networked actor in the world,
for example a door, and you want the player to open it, then you would normally enable his input somehow and call an RPC with “RunOnServer”
INSIDE of the Door Blueprint. But that won’t work (Check link above). A “RunOnServer” RPC only works if the Client OWNS the actor.

Actors that the client owns is for example the PlayerController. You could pass the Clients PlayerController as an owner when SPAWNING an actor.
But then only this specific client can call RPCs on the Actor. So you see, it’s not that easy. It’s more easy to get lost in problems that one doesn’t
understand when networking. Because the code for that door will compile completely fine, but the RPC will never be called and if you don’t know
why, you will spend a lot of your time asking yourself why.