From a35c0dbd9a69779f0fa1fc6f5b6e4014ca5bcefd Mon Sep 17 00:00:00 2001 From: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com> Date: Mon, 16 Jan 2023 07:30:39 -0500 Subject: [PATCH] fix: ChangeOwner now adds/removes from owned hashset We do this in spawn and destroy already. --- Assets/Mirror/Core/NetworkClient.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Mirror/Core/NetworkClient.cs b/Assets/Mirror/Core/NetworkClient.cs index 5d8b9a8b0..6497845d6 100644 --- a/Assets/Mirror/Core/NetworkClient.cs +++ b/Assets/Mirror/Core/NetworkClient.cs @@ -1323,6 +1323,14 @@ internal static void ChangeOwner(NetworkIdentity identity, ChangeOwnerMessage me // set ownership flag (aka authority) identity.isOwned = message.isOwner; + + // Add / Remove to client's connectionToServer.owned hashset. + if (identity.isOwned) + connection?.owned.Add(identity); + else + connection?.owned.Remove(identity); + + // Call OnStartAuthority / OnStopAuthority identity.NotifyAuthority(); // set localPlayer flag