Code stripping

Unity supports code stripping as part of the engine. Code stripping automatically removes unused or unreachable code during the Unity build process, to decrease the application’s final size.

Starting from 1.4.0, we're generating a link.xml file in Assets/coherence/link.xml with the needed directives to support the coherence SDK. This file is generated at build time, and deleted after the build.

If you're on previous versions of the SDK, and you're considering using code stripping above Low level, add the following link.xml file anywhere in your project (e.g., Assets/link.xml):

<linker>
  <assembly fullname="System">
    <type fullname="System.Net.Configuration.ConnectionManagementSection" />
    <type fullname="System.Net.Configuration.ConnectionManagementElementCollection" />
    <type fullname="System.Net.Configuration.NetSectionGroup" />
  </assembly>

  <assembly fullname="System.Configuration">
    <type fullname="System.Configuration.ExeConfigurationHost" />
  </assembly>
</linker>

Read more on how link.xml works in Unity on their code stripping section.

In any case, there's no one-size-fits-all solution to be safe when it comes to code stripping. It highly depends on your project, and also your dependencies (third party libraries and assets used).

If you are experiencing issues with coherence while using code stripping, reach out to us.

Was this helpful?