Skip to content

Commit 18e72ae

Browse files
Merge branch 'develop-2.0.0' into fix/minor-fixes-for-2-1-0-release
2 parents e897d57 + e9b7ef4 commit 18e72ae

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1919

2020
### Fixed
2121

22+
- Fixed issue with service not getting synchronized with in-scene placed `NetworkObject` instances when a session owner starts a `SceneEventType.Load` event. (#3096)
2223
- Fixed issue with the in-scene network prefab instance update menu tool where it was not properly updating scenes when invoked on the root prefab instance. (#3092)
2324
- Fixed issue where applying the position and/or rotation to the `NetworkManager.ConnectionApprovalResponse` when connection approval and auto-spawn player prefab were enabled would not apply the position and/or rotation when the player prefab was instantiated. (#3078)
2425
- Fixed issue where `NetworkObject.SpawnWithObservers` was not being honored when spawning the player prefab. (#3077)

com.unity.netcode.gameobjects/Runtime/SceneManagement/SceneEventData.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ private void SortParentedNetworkObjects()
320320
internal void AddSpawnedNetworkObjects()
321321
{
322322
m_NetworkObjectsSync.Clear();
323+
// If distributed authority mode and sending to the service, then ignore observers
324+
var distributedAuthoritySendingToService = m_NetworkManager.DistributedAuthorityMode && TargetClientId == NetworkManager.ServerClientId;
323325
foreach (var sobj in m_NetworkManager.SpawnManager.SpawnedObjectsList)
324326
{
325-
if (sobj.Observers.Contains(TargetClientId))
327+
if (sobj.Observers.Contains(TargetClientId) || distributedAuthoritySendingToService)
326328
{
327329
m_NetworkObjectsSync.Add(sobj);
328330
}
@@ -666,12 +668,14 @@ internal void SerializeScenePlacedObjects(FastBufferWriter writer)
666668
// Write our count place holder (must not be packed!)
667669
writer.WriteValueSafe((ushort)0);
668670
var distributedAuthority = m_NetworkManager.DistributedAuthorityMode;
671+
// If distributed authority mode and sending to the service, then ignore observers
672+
var distributedAuthoritySendingToService = distributedAuthority && TargetClientId == NetworkManager.ServerClientId;
669673

670674
foreach (var keyValuePairByGlobalObjectIdHash in m_NetworkManager.SceneManager.ScenePlacedObjects)
671675
{
672676
foreach (var keyValuePairBySceneHandle in keyValuePairByGlobalObjectIdHash.Value)
673677
{
674-
if (keyValuePairBySceneHandle.Value.Observers.Contains(TargetClientId))
678+
if (keyValuePairBySceneHandle.Value.Observers.Contains(TargetClientId) || distributedAuthoritySendingToService)
675679
{
676680
// Serialize the NetworkObject
677681
var sceneObject = keyValuePairBySceneHandle.Value.GetMessageSceneObject(TargetClientId, distributedAuthority);

0 commit comments

Comments
 (0)