2018.1 IL2CPP VRModule stripping issue

++++ NOTE: this has been resolved in 2018.1.2f1 and higher ++++

In initial 2018.1 releases, the VRModule engine code can get stripped out of builds in certain situations. If you notice that your built project doesn’t correctly enter VR Mode when run, it could be due to this issue. Here are the settings where this can occur:

  1. VR is enabled.
  2. Scripting Backend is set to ‘IL2CPP’.
  3. Strip Engine Code is checked. (this is the default when IL2CPP is enabled)
  4. No scripts in the project are referencing VRModule.

In this situation, the VRModule is likely to be stripped out of the build and VR won’t work. You can work around this in initial 2018.1 builds by either disabling ‘Strip Engine Code’, or by adding a link.xml file to the root of your project. See Unity - Manual: Managed code stripping for information on using link.xml to control bytecode stripping. Using link.xml is preferable as it allows other code to continue to get stripped out, reducing build size.

Here’s an example link.xml that prevents VRModule from being stripped out:

<linker>
<assembly fullname="UnityEngine.VRModule" preserve="all"/>
</linker>

This should be fixed in an upcoming 2018.1 patch release, at which point you can go ahead and remove the link.xml from your project if it isn’t being used to control any other bytecode stripping.

1 Like

This is fixed in 2018.1.2f1 and higher.