I have been using the undocumented IL post processing API in Unity in my projects for a few years now. It’s been an incredibly useful tool.
However, every time I use it I’m reminded of the fact that it isn’t a public API and could have an unannounced breaking change or be completely removed in a future update.
Are there any plans to make this API public and officially supported? I don’t see its usefulness diminishing any time soon. Even with new features like C# Source Generators, there are some things that can only be done by modifying the IL.
Mirror, a networking library used by many developers, uses this API to implement crucial features, like the [SyncVar] attribute.
I think it’s a missed opportunity to keep this feature hidden and its future uncertain, when it’s already proven to be very useful.
Agreed, it can be very useful for scenarios that don’t work with Source Generators.
It is a good question. IL post processing (ILPP as we call it internally) was initially required internally for DOTS projects. It has helped to solve some problems but it has caused (and it is still to some extend) also significant performance regression during compilation time so that DOTS projects had to move a large part of their processing from ILPP to Roslyn Source Generators.
As we will migrate from our custom compilation pipeline to MSBuild, it might make this custom process less relevant, as, for example, you will be able to use easily projects like Fody to perform IL transforms.
That being said, we know that ILPP is not going away anytime soon, so we should revisit if we want to make this official. For sure, from what you are saying, we need to be very careful at not breaking it if many external projects are heavily relying on it!
I started doing IL post-processing on some of my tools, this is absolutely useful. I hope this system stay here, even if you folks at Unity don’t need in the future, and maybe get documented I bit more.