Code Stripping

Definition

Unity runs a linker over your assemblies and the engine modules and deletes types and methods nothing references. The Managed Stripping Level setting controls how aggressive it is. Code only reached through reflection or serialization is not seen as used, so you preserve it with a link.xml file or attributes.

Relevance

Stripping is a size step. It deletes managed code nothing references, which is why a High setting can remove megabytes of engine and plugin code the game never calls. Code reached only through reflection or by name in a serializer looks unused, so it disappears unless a link.xml file or an attribute keeps it.

Example

You set stripping to High and the build loses several megabytes. A class that is only loaded by name from a config file is removed too, and the game fails when it asks for that class. Adding it to link.xml puts it back.

Connected

Synonyms

Managed stripping, IL linking