diff --git a/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs b/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs index b8ad65fa..d86cb200 100644 --- a/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs +++ b/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs @@ -49,12 +49,13 @@ public static void DoPass(RewriteGlobalContext context, GeneratorOptions options asmContext.NewAssembly.CustomAttributes.Add(targetFrameworkAttribute); } - // Optimize macros in all methods. + // Optimize macros in all methods and assign tokens. foreach (var type in module.GetAllTypes()) { foreach (var method in type.Methods) { method.CilMethodBody?.Instructions.OptimizeMacros(); + module.TokenAllocator.AssignNextAvailableToken(method); } } }