I’ve trying to learn a Networking with blueprints (replication, client/server and etc).
I’ve made UMG Widget, there was no Owner, I saw the buttons on Server and Client.
I wanted to make one thing -
When on server pressed a button on the screen, this button on client disappear (it works) - multicast way.
But when I trying to press button on the client, I can’t get a button disappeared on server.
What you need to do is create a function marked as Server. This is how the client gives commands to the server. Once the server receives the command it can call the same multicast you mentioned and it should work.
ok, that’s clear
but if client won’t own the target (if I understand right), function won’t work,
and my mind is blowing there.
Can you show me an example?
Unfortunately I am on my phone so I can’t provide any examples. But overall, remember that stuff like pawns, the gamestate and your controller exist on the server. If an event is marked with Run On Server it won’t execute on the client only on the server.
The caveat is that UMG is client only. So what you would do is e.g. have an event in your game state called “UpdateButtonState” marked as Server. You’d run this from your client and it would fire on the server. From there on you can fetch the widget and update it (all of this will happen on the server only).
I tried it on PlayerController (on GameState it should work too, i suppose), thank you!
Make a Widget in PC, then launched an “On Server” event to make button hidden, and it worked. I don’t know is it a common idea, anyway