Commit 1845a33
authored
fix: synchronizing connected clients additively loaded scenes only when server (#3133)
* fix
This fixes the issue when starting NetworkManager as server only, connecting one or more clients, and then loading a scene and the in-scene placed NetworkObjects do not get synchronized with the clients (but once the scene is loaded late joining clients do get synchronized).
This had to do with an adjustment to determining which in-scene placed NetworkObjects should be synchronized based on their observers coupled with both when running as just a server the server would not add itself to the observer list (in-scene placed only) and the update to NetworkSceneManager.SendSceneEventData where it never was updated with the more recent changes to SceneEventData (i.e. only serializing the in-scene placed NetworkObjects a client is observing) and still just queueing the message to be sent with a full list of target ids as opposed to sending each individual message while setting the SceneEventData.TargetClientId.
* test
Updating some of the scene management related integration tests to validate the issue associated with this PR as well as adding a server (non-host) set to some of the integration tests that were only validating with a host.
* style
adding comment and removing extra CR/LF.
* update
adding changelog entries
* test - fix
Fixing issue with the updated InScenePlacedNetworkObjectTests that were using the server-side player for some of the tests which doesn't exist when it is just a server.
Fixing issue with the expected number of spawned objects since the base value was derived from TotalClients that changes when running a server.1 parent 487e469 commit 1845a33
File tree
8 files changed
+116
-41
lines changed- com.unity.netcode.gameobjects
- Runtime
- SceneManagement
- Spawning
- TestHelpers/Runtime
- testproject/Assets/Tests/Runtime/NetworkSceneManager
8 files changed
+116
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
1084 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1085 | 1087 | | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1090 | 1096 | | |
1091 | | - | |
1092 | 1097 | | |
1093 | 1098 | | |
1094 | 1099 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1119 | 1119 | | |
1120 | 1120 | | |
1121 | 1121 | | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1122 | 1128 | | |
1123 | 1129 | | |
1124 | 1130 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1759 | 1759 | | |
1760 | 1760 | | |
1761 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
1762 | 1769 | | |
1763 | 1770 | | |
1764 | 1771 | | |
| |||
Lines changed: 40 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
94 | 114 | | |
95 | 115 | | |
96 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
97 | 120 | | |
98 | 121 | | |
99 | 122 | | |
| |||
104 | 127 | | |
105 | 128 | | |
106 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
107 | 142 | | |
108 | 143 | | |
109 | 144 | | |
| |||
0 commit comments