Skip to content

Commit b43c35d

Browse files
fix
Reverting some of the opinionated restrictions to permissions with in-scene placed NetworkObjects. Matching the DAHost redistribution logic to follow that of the rust servers when a client disconnects.
1 parent 0eec5e2 commit b43c35d

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,16 +1195,13 @@ internal void OnClientDisconnectFromServer(ulong clientId)
11951195
}
11961196
else if (!NetworkManager.ShutdownInProgress)
11971197
{
1198-
// DANGO-TODO: We will want to match how the CMB service handles this. For now, we just try to evenly distribute
1199-
// ownership.
1200-
// NOTE: All of the below code only handles ownership transfer.
1198+
// NOTE: All of the below code only handles ownership transfer
12011199
// For client-server, we just remove the ownership.
1202-
// For distributed authority, we need to change ownership based on parenting
1200+
// For distributed authority (DAHost only), we only transfer objects that are not parented or belong to the session owner.
1201+
// Rust server handles the object redistribution on its end.
12031202
if (NetworkManager.DistributedAuthorityMode)
12041203
{
1205-
// Only NetworkObjects that have the OwnershipStatus.Distributable flag set and are not OwnershipSessionOwner are distributed.
1206-
// If the object has a parent - skip it for now, it will be distributed when its root parent is distributed.
1207-
if (!ownedObject.IsOwnershipDistributable || ownedObject.IsOwnershipSessionOwner || ownedObject.GetCachedParent())
1204+
if (ownedObject.IsOwnershipSessionOwner || ownedObject.GetCachedParent())
12081205
{
12091206
continue;
12101207
}

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,6 @@ private void CheckForInScenePlaced()
325325

326326
// Default scene migration synchronization to false for in-scene placed NetworkObjects
327327
SceneMigrationSynchronization = false;
328-
329-
// Root In-scene placed NetworkObjects have to either have the SessionOwner or Distributable permission flag set.
330-
if (transform.parent == null)
331-
{
332-
if (!Ownership.HasFlag(OwnershipStatus.SessionOwner) && !Ownership.HasFlag(OwnershipStatus.Distributable))
333-
{
334-
Ownership |= OwnershipStatus.Distributable;
335-
}
336-
}
337328
}
338329
}
339330
#endif // UNITY_EDITOR

0 commit comments

Comments
 (0)