diff --git a/Assets/Mirror/Editor/Weaver/Readers.cs b/Assets/Mirror/Editor/Weaver/Readers.cs index 72e3297d4..d381b3f2b 100644 --- a/Assets/Mirror/Editor/Weaver/Readers.cs +++ b/Assets/Mirror/Editor/Weaver/Readers.cs @@ -46,7 +46,6 @@ internal void Register(TypeReference dataType, MethodReference methodReference) void RegisterReadFunc(TypeReference typeReference, MethodDefinition newReaderFunc) { Register(typeReference, newReaderFunc); - GeneratedCodeClass.Methods.Add(newReaderFunc); } @@ -54,14 +53,10 @@ void RegisterReadFunc(TypeReference typeReference, MethodDefinition newReaderFun public MethodReference GetReadFunc(TypeReference variable, ref bool WeavingFailed) { if (readFuncs.TryGetValue(variable, out MethodReference foundFunc)) - { return foundFunc; - } - else - { - TypeReference importedVariable = assembly.MainModule.ImportReference(variable); - return GenerateReader(importedVariable, ref WeavingFailed); - } + + TypeReference importedVariable = assembly.MainModule.ImportReference(variable); + return GenerateReader(importedVariable, ref WeavingFailed); } MethodReference GenerateReader(TypeReference variableReference, ref bool WeavingFailed)