this feature requires Unity 2019.3 or later.
VContainer has the ability to perform the meta programming part faster by generating IL code at compile time. As a result, there is no reflection at runtime, and it is expected to be 3-6x faster. It works in the IL2CPP environment.
With VContainer, for example, the following code (as IL) is automatically generated:
VContainer.EnableCodeGen asmdef to your references#
If you have asmdef in your project that refers to the following 2 asmdef, they are targets for IL weaving.
The next time the specified assembly is compiled, VContainer will make changes to the compiled dll.
If it succeeds, it will be logged. For example:
VContainer code generation optimization for MyGame.dll 24 types (40.0355ms)
In Unity 2020.2 and later, the ILPostProcessor can no longer output logs. As a temporary measure, the above log is output as a warning, but it may be removed in the future.