From 22ac763199493c171cd657abde0c25d59608fc1a Mon Sep 17 00:00:00 2001 From: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com> Date: Fri, 20 Jan 2023 19:32:06 -0500 Subject: [PATCH] NetworkTransformBase - OnClientAuthorityChanged is Server Only --- Assets/Mirror/Components/NetworkTransformBase.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Components/NetworkTransformBase.cs b/Assets/Mirror/Components/NetworkTransformBase.cs index f084022ef..1cfe66875 100644 --- a/Assets/Mirror/Components/NetworkTransformBase.cs +++ b/Assets/Mirror/Components/NetworkTransformBase.cs @@ -281,15 +281,20 @@ public virtual void Reset() protected virtual void OnEnable() { Reset(); - NetworkIdentity.clientAuthorityCallback += OnClientAuthorityChanged; + + if (NetworkServer.active) + NetworkIdentity.clientAuthorityCallback += OnClientAuthorityChanged; } protected virtual void OnDisable() { Reset(); - NetworkIdentity.clientAuthorityCallback -= OnClientAuthorityChanged; + + if (NetworkServer.active) + NetworkIdentity.clientAuthorityCallback -= OnClientAuthorityChanged; } + [ServerCallback] void OnClientAuthorityChanged(NetworkConnectionToClient conn, NetworkIdentity identity, bool authorityState) { if (identity != netIdentity) return;