The following code prints different values for the same variable:
This variable isn’t being reset anywhere else (that I’m aware of).
I’m assuming that I’m doing something wrong because I’m assuming it isn’t possible
The following code prints different values for the same variable:
This variable isn’t being reset anywhere else (that I’m aware of).
I’m assuming that I’m doing something wrong because I’m assuming it isn’t possible
You are not doing somthing wrong. Your variable has not two values.
You have two different variables with the same name…
One of them is in the server side, the other is in the cliente side.
Use the node “switch has authority” to handle the side you want.
Or replicate the variable so the client will copy the value the server has.
(Joel is in the client and Solo is in the server).
Hi, thanks for the reply.
My project doesn’t have any server-side things implemented, it’s basically just a blank project with a few test meshes in it. Is the server component on by default?
I set replication on the variable to “replicated”, but I didn’t see any difference.
Yes, the server is activated by default… you can not disable it.
In fact, when you run the game as “standalone” your roll is the authority (the server).
Do not replicate variables if you are making a single player game… it is not necessary… but in this case you must ignore the client side then. (You only can change the value of the a replicated variable in the server side… otherways it won’t work well).
If you are making a multiplayer game only replicate variables extrictly necessary.
Do this test
Hi,
So sorry for the delayed response.
I can’t add the “switch has authority” node in a widget. Is that why I’m running in to this issue?
Widgets only work in client side… server does has not sounds, particles or widgets…
The exception is if you are the host player, in this case you are the server and obviously you have sounds, particles and widgets.
GameMode → Server Only
PlayerController → Server and Client
HUD → Client Only
PlayerState → Server and Client
GameState → Server and Client
GameSession → Server Only
If you need to do server things from a widged use the player controller as proxy and RPCs