--- title: "Managed Code Stripping" slug: "unity-managed-code-stripping" description: "Usercentrics Unity SDK supports all managed stripping levels with an included link.xml, preserving serialization and iOS ATT functionality at Medium or High." updated: 2026-11-17T03:47:44Z published: 2026-11-17T03:47:44Z canonical: "usercentrics.com/unity-managed-code-stripping" --- > ## Documentation Index > Fetch the complete documentation index at: https://usercentrics.com/docs/llms.txt > Use this file to discover all available pages before exploring further. # Managed Code Stripping Unity's [managed code stripping](https://docs.unity3d.com/Manual/ManagedCodeStripping.html) removes unused C# code at build time to reduce binary size. The Usercentrics Unity SDK is fully compatible with all Unity managed stripping levels. ## Supported Stripping Levels | Level | Value | Status | | --- | --- | --- | | Minimal | 0 | ✅ Supported | | Low | 1 | ✅ Supported | | Medium | 2 | ✅ Supported | | High | 3 | ✅ Supported | > **Recommended Minimum** > > We recommend **Medium** as the minimum stripping level for production builds. The SDK has been validated at Medium and High on both iOS and Android. ## How It Works The SDK ships with a `link.xml` file inside the `.unitypackage` at `Assets/Usercentrics/link.xml`. This file instructs the Unity linker to preserve the `Unity.Usercentrics` assembly at build time. **No configuration is required.** Importing the `.unitypackage` is sufficient — the `link.xml` is picked up by Unity automatically regardless of your stripping level. > **Why is a link.xml needed?** > > Two areas of the SDK require explicit linker preservation: > > 1. **Data model serialization** — The SDK uses `JsonUtility.FromJson<T>()` to deserialize responses from the native bridge. Unity's linker cannot statically trace through generic type parameters, so the data model fields appear "unreferenced" and are removed at Medium/High stripping levels, causing silent data loss at runtime. > 2. **iOS ATT reflection** — The App Tracking Transparency post-processor uses `GetField()` and `GetCustomAttributes()` on `Language` enum values at build time. Without preservation, `IsoCodeAttribute` is stripped before the post-processor runs. ## Multiple link.xml Files If your project already contains a `link.xml`, Unity automatically merges all `link.xml` files at build time. There is no conflict with the SDK's `link.xml`. ## Configuring Stripping Level 1. Open **Edit → Project Settings → Player** 2. Select the **Android** or **iOS** tab 3. Under **Other Settings → Optimization**, set **Managed Stripping Level** to your preferred level #### Android ![](https://cdn.document360.io/17f91ed2-e9be-4746-9f2b-1fa43f97e9b5/Images/Documentation/image(178).png?sv=2026-02-06&spr=https&st=2026-11-20T09%3A12%3A44Z&se=2026-11-20T10%3A12%3A44Z&sr=b&sp=r&sig=sVuZy9Ubml3j6ALBcRRDFzM0j0qirQsUzpgmI9y%2F924%3D) #### iOS ![](https://cdn.document360.io/17f91ed2-e9be-4746-9f2b-1fa43f97e9b5/Images/Documentation/image(179).png?sv=2026-02-06&spr=https&st=2026-11-20T09%3A12%3A44Z&se=2026-11-20T10%3A12%3A44Z&sr=b&sp=r&sig=Pnn8q33FlDjsqIPmt9ORBcca5at27MQwH%2B6zSudJpOY%3D) > **IL2CPP Required for High Stripping** > > Managed stripping level **High** is only available when using the **IL2CPP** scripting backend. To switch: **Player Settings → Other Settings → Scripting Backend → IL2CPP**.