// support additive scene loads: // NetworkScenePostProcess disables all scene objects on load, and // * NetworkServer.SpawnObjects enables them again on the server when // calling OnStartServer // * ClientScene.PrepareToSpawnSceneObjects enables them again on the // client after the server sends ObjectSpawnStartedMessage to client // in SpawnObserversForConnection. this is only called when the // client joins, so we need to rebuild scene objects manually again // TODO merge this with FinishLoadScene()? void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (mode == LoadSceneMode.Additive) { if (NetworkServer.active) { // TODO only respawn the server objects from that scene later! NetworkServer.SpawnObjects(); Debug.Log("Respawned Server objects after additive scene load: " + scene.name); } if (NetworkClient.active) { ClientScene.PrepareToSpawnSceneObjects(); Debug.Log("Rebuild Client spawnableObjects after additive scene load: " + scene.name); } } }