Does unet allow you to use don’t destroy on load on player objects so that the same player object can pass from scene to scene. I’ve tried it, and after the scene change the player object’s network identity has no observers. It is still able to send commands but it cannot receive them (so all Rpcs stop working).
Am I doing something wrong or does unet require that I destroy all player objects and rebuild them at the start of the new scene?
If this is the case, what’s the best way to get the objects neatly rebuilt?
Even if it can be done, is it considered bad practice?
How about loadlevelasync additive instead.
// Did you destroy NetworkManager.
Did you manage to solve the issue with the player object losing it’s observers? I have the exact same issue. After scene change via NetworkManager.ServerChangeScene() the scene on all clients changes but Rpc’s stop working.
DontDestroyOnLoad is on the Networkmanager and the Player Object
You have to understand 2 things :
-Player objects are normal Unity object. It’s only their networkIdentity which specify whom they are when you send Rpc/Command. So you can destroy these objects in client or server how you want. If a clients does not have this object in the game and a RPC is send for this object it will only thow the error message : “behavior for incoming message …”
-Observers are added in Network.Spawn(); method. If the gameObject is disabled, no observer are added (yes it’s stupid). The NetworkManager.ChangeScene() set client not ready. So clients no longer observe nothing. You have to ClientScene.Ready() when the scene is loaded. Observers are here to know what client is observing what object.
So as long as your clients are ready and all clients have all gameObjects in the scene … it’s pretty ok !