Skip to content

Commit cf31acd

Browse files
update
Removing the "double synch" from within the connection approval handler method as it is no longer needed.
1 parent eeaff40 commit cf31acd

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ConnectionApprovedMessage.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,21 +366,18 @@ public void Handle(ref NetworkContext context)
366366

367367
if (!networkManager.SceneManager.IsRestoringSession)
368368
{
369-
// Synchronize the service with the initial session owner's loaded scenes and spawned objects
370-
networkManager.SceneManager.SynchronizeNetworkObjects(NetworkManager.ServerClientId, true);
371-
372369
// Spawn any in-scene placed NetworkObjects
373370
networkManager.SpawnManager.ServerSpawnSceneObjectsOnStartSweep();
374371

372+
// Synchronize the service with the initial session owner's loaded scenes and spawned objects
373+
networkManager.SceneManager.SynchronizeNetworkObjects(NetworkManager.ServerClientId, true);
374+
375375
// Spawn the local player of the session owner
376376
if (networkManager.AutoSpawnPlayerPrefabClientSide)
377377
{
378378
networkManager.ConnectionManager.CreateAndSpawnPlayer(OwnerClientId);
379379
}
380380

381-
// Synchronize the service with the initial session owner's loaded scenes and spawned objects
382-
networkManager.SceneManager.SynchronizeNetworkObjects(NetworkManager.ServerClientId, true);
383-
384381
// With scene management enabled and since the session owner doesn't send a scene event synchronize to itself,
385382
// we need to notify the session owner that everything should be synchronized/spawned at this time.
386383
networkManager.SpawnManager.NotifyNetworkObjectsSynchronized();

0 commit comments

Comments
 (0)