fix: #3343 allow modifying client synclists for unspawned objects like character previews

This commit is contained in:
vis2k 2023-01-04 01:32:11 +01:00
parent 8570afab94
commit 0d53f7c3a0

View File

@ -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.");