From 0d53f7c3a03ceca31207d0389c57c9c16275a722 Mon Sep 17 00:00:00 2001 From: vis2k Date: Wed, 4 Jan 2023 01:32:11 +0100 Subject: [PATCH] fix: #3343 allow modifying client synclists for unspawned objects like character previews --- Assets/Mirror/Core/NetworkBehaviour.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/Mirror/Core/NetworkBehaviour.cs b/Assets/Mirror/Core/NetworkBehaviour.cs index 6ef4e0948..42613bed7 100644 --- a/Assets/Mirror/Core/NetworkBehaviour.cs +++ b/Assets/Mirror/Core/NetworkBehaviour.cs @@ -247,7 +247,14 @@ protected void InitSyncObject(SyncObject syncObject) // client only: only ClientToServer and owned if (NetworkClient.active) - return syncDirection == SyncDirection.ClientToServer && isOwned; + { + // spawned: only ClientToServer and owned + if (netId != 0) return syncDirection == SyncDirection.ClientToServer && isOwned; + + // not spawned (character selection previews, etc.): always allow + // fixes https://github.com/MirrorNetworking/Mirror/issues/3343 + return true; + } // undefined behaviour should throw to make it very obvious throw new Exception("InitSyncObject: IsWritable: neither NetworkServer nor NetworkClient are active.");