Multiplayer can't create widget on client side (Advanced Steam Sessions)

Hello UE4-Community,

I’m working on my ue-project since almost 2 years and I decided to implement a multiplayer mode now, after I got done a really good working singleplayer version.

At the beginning of multiplayer, things weren’t easy, but I always found a way to solve the upcoming problems and bugs. But now I’m standing in front of a bug since something about 20 hours, I read a lot about creating widgets in multiplayer, I watched a few videos and tried some things on my own, but I couldn’t find the actual mistake on my side.

I would really appreciate it, if someone could help me with my problem to create widgets on the client side.

Now I would like to introduce you to my whole multiplayer setup at the moment, to give you a good overview and hopefully a basis to fix my issue here.

You can find all relevant screenshots from the code on my Google Drive:

  • MP-Plugins: Advanced Sessions, Advanced Steam Sessions
  • MainMenu widget on game start (no multiplayer at this point)
  • Multiplayer-Menu with “Find Games” and “Host Game”
  • Find Games (Find Sessions Advanced)
  • Host Game (Create Advanced Session)
  • TopDownGameMode (OnPostLogin → Spawning my PlayerCharacter, initializing some variables etc.)
  • TopDownController (Trying to create the widget (IngameOverlayMenu) here, but also tried in PlayerCharacter)

All in all my Problem is, that the basics of my multiplayer is working.

  • Listen-server (host) and client are successfully spawned
  • Both can walk around, the world is loading etc.
  • Listen-Server has widgets and can access them easily

But there won’t be created any widgets on the client-side, I mean there is just one debug instance of the IngameOverlayMenu (also includes inventory) for example, the one for the listen-server.

It is also very strange, that the client gets and inventory and can open/close it, but I don’t have an instance of it and it is definitly not the same as the listen-server has it.

I hope my descriptions and screenshots can anyone assist to help me :slight_smile:
If you have any further questions please ask them.

Hi, generally speaking widgets never replicate, they only exist locally. That means that if the widget does not spawn on a client, then that is cause you don’t spawn it on that client (you could try to do a print to see whether the client executes the spawn logic for the widget locally).

Thanks for your reply.
How could I test that in the best way?

I would do a print and see if the client prints it (with prints you see something like Server: … that would mean the server prints it, or something like Client1: … that would mean the clients prints it).

Also in your images I only see that you’re spawning the IngameOverlayMenu on the clients, nothing else (but maybe I missed something). The MainMenu gets spawned on the sever inside the GameMode (which only exists on the server, clients can never access the game mode and therefore having replicated variables inside the GameMode will do nothing).

Also widgets never replicate, so replicating a object reference to a widget will do nothing.

Okay, I will try that :slight_smile:

Yes that’s true, but the MainMenu is supposed to be created for everyone on game start - that works fine so far. In this case I will remove the replication, because it doesn’t do anything and later on I need to create the MainMenu again on client-side, so I can access it while the players are in the game session.

I tried it like in the screenshot below. In the game on the server screen I got the response “TEST” and on the client screen as well. But without “Server:” or “Client:”. But because of the print on the correct screen, I think it’s correct so far.
I forgot to say, that on the server side the return of “Create Widget IngameOverlayMenu” is an valid instance _0. But on client-side I only get a return of “None”. I also googled a lot about this topic in the past, but I didn’t found any solution for that problem - I think that’s my main problem as well.

Thanks for your reply again:
I will try the things you said.

“Printing directly after the create widget?” Yes correctly.

Ok, so you got problems with the IngameOverlayMenu?

And what blueprint is that where that image is from?

Also you’re creating it via EventBeginPlayer → RunOnOwningClient. Everyone will execute event begin play and every client that executes that will execute the RunOnOwningClient event. As for the server, if that actor is owned by a client than it will replicate that to that owning client, otherwise server executes it. Or in other words, you may create this widget several times on the same client. Also I wouldn’t replicate the widget object reference, no idea what will happen if the server sets it and tries to replicate that to the client (since that reference will be None on the client…)

But on client-side I only get a return
of “None”

Printing directly after the create widget?

Maybe try a minimalistic example, so just spawn a dummy widget on the client and add it to the viewport without doing anything with it and see if that works and then go from that to what you’re now have. And then also create that dummy widget inside the player controller. So EventBeginPlay → IsLocalController → CreateWidget