diff --git a/Assets/Mirror/Editor/Weaver/Readers.cs b/Assets/Mirror/Editor/Weaver/Readers.cs index 82bf93fb5..07df282c5 100644 --- a/Assets/Mirror/Editor/Weaver/Readers.cs +++ b/Assets/Mirror/Editor/Weaver/Readers.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; @@ -8,6 +9,7 @@ namespace Mirror.Weaver public static class Readers { const int MaxRecursionCount = 128; + public static Dictionary readFuncs; public static MethodReference GetReadFunc(TypeReference variable, int recursionCount = 0) { @@ -17,7 +19,7 @@ public static MethodReference GetReadFunc(TypeReference variable, int recursionC return null; } - if (Weaver.WeaveLists.readFuncs.TryGetValue(variable.FullName, out MethodReference foundFunc)) + if (readFuncs.TryGetValue(variable.FullName, out MethodReference foundFunc)) { if (foundFunc.ReturnType.IsArray == variable.IsArray) { @@ -72,7 +74,7 @@ public static MethodReference GetReadFunc(TypeReference variable, int recursionC static void RegisterReadFunc(string name, MethodDefinition newReaderFunc) { - Weaver.WeaveLists.readFuncs[name] = newReaderFunc; + readFuncs[name] = newReaderFunc; Weaver.WeaveLists.generatedReadFunctions.Add(newReaderFunc); Weaver.ConfirmGeneratedCodeClass(); diff --git a/Assets/Mirror/Editor/Weaver/Weaver.cs b/Assets/Mirror/Editor/Weaver/Weaver.cs index 34c8ba39f..6bb46b494 100644 --- a/Assets/Mirror/Editor/Weaver/Weaver.cs +++ b/Assets/Mirror/Editor/Weaver/Weaver.cs @@ -24,8 +24,6 @@ class WeaverLists // [SyncEvent] invoke functions that should be replaced. dict public Dictionary replaceEvents = new Dictionary(); - public Dictionary readFuncs; - public List generatedReadFunctions = new List(); public List generatedWriteFunctions = new List(); @@ -385,7 +383,7 @@ static void SetupTargetTypes() static void SetupReadFunctions() { - WeaveLists.readFuncs = new Dictionary + Readers.readFuncs = new Dictionary { { singleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadSingle") }, { doubleType.FullName, Resolvers.ResolveMethod(NetworkReaderType, CurrentAssembly, "ReadDouble") },