Skip to content

Commit 0b6522a

Browse files
update
This update utilizes some already existing properties within the ChangeOwnershipMessage to define which clients should receive the change in ownership message.
1 parent 3a0f367 commit 0b6522a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,11 @@ internal void ChangeOwnership(NetworkObject networkObject, ulong clientId, bool
587587
{
588588
networkObject.ChildNetworkBehaviours[i].UpdateNetworkProperties();
589589
}
590-
// DANGO-TODO: We have no current way of handling the list of clients that should receive this message.
591-
// --- NGO: Extend ChangeOwnershipMessage to contain a list of client identifiers.
592-
// --- CMB Service: Needs to be adjusted to only forward the message provided in the list of client identifiers.
590+
591+
// DANGO-TODO: CMB Service needs to be updated to check for these two already existing properties.
592+
message.ClientIds = NetworkManager.ConnectedClientsIds.Where((c) => c != NetworkManager.ServerClientId || !IsObjectVisibilityPending(c, ref networkObject)).ToArray();
593+
message.ClientIdCount = message.ClientIds.Length;
594+
593595
size = NetworkManager.ConnectionManager.SendMessage(ref message, NetworkDelivery.ReliableSequenced, NetworkManager.ServerClientId);
594596
NetworkManager.NetworkMetrics.TrackOwnershipChangeSent(NetworkManager.LocalClientId, networkObject, size);
595597
}

0 commit comments

Comments
 (0)