Skip to content

Code Stripping

Vladislav Kantaev edited this page Apr 24, 2021 · 5 revisions

Because injection relies on "unused" Construct methods, there may be problems related to code stripping: with particular stripping settings, these methods may get removed from the final build.
The framework should work with Managed Stripping Level set to Low out of the box.
For other levels, there are several options:

  • Bake injection: methods will have explicit references to them. However, this is error prone because requires frequent baking to keep things consistent.
  • Adding a link.xml that prevents the default Unity assembly (Assembly-CSharp) from getting stripped. If you use assembly definitions in your code, you should create extra link.xml files to ensure nothing would get stripped.
  • Marking methods with Unity's built-in Preserve attribute. There is a suitable live template for Rider IDE.

In case of any problems related to code stripping, refer to the official manual.

Clone this wiki locally