diff --git a/Assets/Mirror/Editor/Weaver/Processors/ReaderWriterProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/ReaderWriterProcessor.cs index a5703e178..fcdbe0419 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/ReaderWriterProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/ReaderWriterProcessor.cs @@ -15,6 +15,16 @@ public static bool Process(AssemblyDefinition CurrentAssembly, Writers writers, { // find readers/writers from Mirror.dll first // which are the ones in NetworkReader/WriterExtensions class. + ProcessMirrorAssemblyReaderWriterExtensions(CurrentAssembly, writers, readers, ref WeavingFailed); + + // find readers/writers in the assembly we are in right now. + return ProcessAssemblyClasses(CurrentAssembly, CurrentAssembly, writers, readers, ref WeavingFailed); + } + + static void ProcessMirrorAssemblyReaderWriterExtensions(AssemblyDefinition CurrentAssembly, Writers writers, Readers readers, ref bool WeavingFailed) + { + // we search all assemblies to find Mirror.dll. + // then find all NetworkReader/WriterExtensions. foreach (Assembly unityAsm in CompilationPipeline.GetAssemblies()) { if (unityAsm.name == "Mirror") @@ -26,9 +36,6 @@ public static bool Process(AssemblyDefinition CurrentAssembly, Writers writers, } } } - - // find readers/writers in the assembly we are in right now. - return ProcessAssemblyClasses(CurrentAssembly, CurrentAssembly, writers, readers, ref WeavingFailed); } static bool ProcessAssemblyClasses(AssemblyDefinition CurrentAssembly, AssemblyDefinition assembly, Writers writers, Readers readers, ref bool WeavingFailed)