I am developing a game using the client-server mode. Two clients connect to the server and start to synchronize the objects of the server. How do I know the progress of the synchronization between the two clients?
Thanks
I am developing a game using the client-server mode. Two clients connect to the server and start to synchronize the objects of the server. How do I know the progress of the synchronization between the two clients?
Thanks
Hi,
You can register to the OnClientConnected callback from the NetworkManager. This gets invoked when the client finishes connecting.
If you are using the integrated scene management, you can use the NetworkSceneManager’s scene event callbacks as well. For example, OnSynchronize gets invoked when a client begins to synchronize its scenes and NetworkObjects with the server, and OnSynchronizeComplete gets invoked when the client finishes synchronizing its scenes and NetworkObjects.
See Timing considerations | Unity Multiplayer Networking for more details on the timing of those callbacks
Thanks!
The synchronization start and end events you mentioned can solve some problems, but how to display the progress bar in synchronization still cannot be solved.
In the majority of cases “ready” or “not ready” is sufficient. Unless you’re spending excessive amounts of time syncronizing, the amount of time between ‘not ready’ and ‘ready’ is quite small.