- Home /
Why is my SyncVar int not resynchronizing every time a client connects?
Hello. So I have a SyncVar int called "seed", and I have the server replace the default value (0) with a random seven-digit seed when the server starts. But the problem arises when a player first connects when the seed has already been set, and apparently even though the client has connected with a default seed of 0, the server does not feel the need to update the newly connected player's speed accordingly. Can't I force it to resync every variable marked with SyncVar whenever a new player connects? Thanks.
if the SyncVar is part of a networked gameobject in the scene, it should be set once and available to connecting players in OnStartClient.
if the SyncVar is part of the spawned player, you need to set it on the server for each player connecting because every player has a new SyncVar it replicates to the clones on the clients.
The SyncVar is part of a script on a GameObject in the scene with a Network Identity attached to it.
then if you set it in OnStartServer, it should contain the new value in OnStartClient on every connecting client.
Your answer
