We want to bring a few of Cecil’s post-processing features into our Unity game, but have run into an unknown issue I haven’t seen anyone get. Basically, in our post-processor file (Assets/Editor/SixMinutePostprocess.cs),
using UnityEditor;
using System;
using Mono.Cecil;
[InitializeOnLoadAttribute]
static class SixMinutePostprocess
{
static SixMinutePostprocess()
{
Console.WriteLine("Init AssemblyPostProcessor");
string path = "Library/ScriptAssemblies/Assembly-CSharp.dll";
ModuleDefinition.ReadModule(path).Write(path);
}
}
But when that’s done, Unity’s main application gives out about all sorts of things missing, and when you check the newly altered dll, it’s an empty file, zero bytes. Running similar code outside of Unity gives expected results, but I can’t figure out how to get it to run properly with Unity’s builders.
I’m using the Cecil build from Unity’s own Github, Releases · Unity-Technologies/cecil · GitHub (which, as I said, works as expected in another project).