Skip to content

Reconnection and Hot-Reload

NetBuff supports mid/end-game connections seamlessly: Each NetworkIdentity from every scene will be synchronized, maintaining its values and additional serialized data. Even in the editor, you can edit the code, recompile the project, and the server will seamlessly maintain its state (clients will need to reconnect, but even their player objects will be kept in the same state without data loss).

To keep the system running, you must ensure that the object state values are synchronized over the network, either using NetworkValues or utilizing callbacks from the INetworkBehaviourSerializer interface. If you need additional synchronization, you can also request a custom package in the NetworkBehaviour.OnSpawned callback, using the isRetroactive parameter to check if it's a late synchronization or not.

Tip

We strongly recommend that after every significant modification/addition to the system, developers perform the following checks:

  1. Hot-Reload functionality still works with your system.
  2. Players who connect mid/end-game do not encounter issues synchronizing the state of your game.

These two checks ensure you won't have network state synchronization problems, and every client/player will be able to synchronize the game state seamlessly. Hot-Reload isn't necessary but can expedite network testing (in addition to demonstrating the application of best practices), as you can modify the code and NetworkValues via the inspector without losing the current server state.