diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index fab2e97f48..065f0a09ea 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -13,6 +13,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Fixed +- Fixed issue where root level in-scene placed `NetworkObject`s would only allow the ownership permission to be no less than distributable or sessionowner. (#3407) ### Changed diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs index dbdff3ca2b..59a187a5fc 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs @@ -1195,16 +1195,13 @@ internal void OnClientDisconnectFromServer(ulong clientId) } else if (!NetworkManager.ShutdownInProgress) { - // DANGO-TODO: We will want to match how the CMB service handles this. For now, we just try to evenly distribute - // ownership. - // NOTE: All of the below code only handles ownership transfer. + // NOTE: All of the below code only handles ownership transfer // For client-server, we just remove the ownership. - // For distributed authority, we need to change ownership based on parenting + // For distributed authority (DAHost only), we only transfer objects that are not parented or belong to the session owner. + // Rust server handles the object redistribution on its end. if (NetworkManager.DistributedAuthorityMode) { - // Only NetworkObjects that have the OwnershipStatus.Distributable flag set and are not OwnershipSessionOwner are distributed. - // If the object has a parent - skip it for now, it will be distributed when its root parent is distributed. - if (!ownedObject.IsOwnershipDistributable || ownedObject.IsOwnershipSessionOwner || ownedObject.GetCachedParent()) + if (ownedObject.IsOwnershipSessionOwner || ownedObject.GetCachedParent()) { continue; } diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs index 502ffefcb6..64c8e96076 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs @@ -325,15 +325,6 @@ private void CheckForInScenePlaced() // Default scene migration synchronization to false for in-scene placed NetworkObjects SceneMigrationSynchronization = false; - - // Root In-scene placed NetworkObjects have to either have the SessionOwner or Distributable permission flag set. - if (transform.parent == null) - { - if (!Ownership.HasFlag(OwnershipStatus.SessionOwner) && !Ownership.HasFlag(OwnershipStatus.Distributable)) - { - Ownership |= OwnershipStatus.Distributable; - } - } } } #endif // UNITY_EDITOR