From 42ef277642e91c80ee5855fb92def32b44446284 Mon Sep 17 00:00:00 2001 From: Nietod <119692307+Nietod@users.noreply.github.com> Date: Sat, 7 Feb 2026 15:38:30 +0100 Subject: [PATCH 1/2] fix: Error on SyncVar Writing in Generic --- .../Weaver/Processors/SyncVarAttributeAccessReplacer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs b/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs index 73a9526342b..26dc4a9812d 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs @@ -94,6 +94,12 @@ static int ProcessInstruction(Logger Log, SyncVarAccessLists syncVarAccessLists, // [SyncVar]? if (field.HasCustomAttribute()) { + if (field.Module == md.Module) + { + ProcessSetInstruction(syncVarAccessLists, md, instr, field); + return iCount; + } + // ILPostProcessor would need to Process() the assembly's // references before processing this one. // we can not control the order. From 3363ec315834e226615ad6725d3f7b5479b0ff53 Mon Sep 17 00:00:00 2001 From: mischa <16416509+miwarnec@users.noreply.github.com> Date: Sat, 14 Nov 2026 09:19:45 +0100 Subject: [PATCH 2/2] Apply suggestion from @miwarnec --- .../Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs b/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs index 26dc4a9812d..b785233a5f3 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeAccessReplacer.cs @@ -94,6 +94,8 @@ static int ProcessInstruction(Logger Log, SyncVarAccessLists syncVarAccessLists, // [SyncVar]? if (field.HasCustomAttribute()) { + // support SyncVars in generic components like Comp: NetworkBehaviour + // https://github.com/MirrorNetworking/Mirror/pull/4093/ if (field.Module == md.Module) { ProcessSetInstruction(syncVarAccessLists, md, instr, field);