Having problems building your project or running your built project?
IL2CPP Code Stripping #
Using the IL2CPP scripting backend will result in Unity’s compiler stripping/removing code it considers unused. While this isn’t a problem in most cases, it can result in errors due to missing code or DLL files in your built game – especially when reflection is used to access code, which is the case for most Makinom plugins.
You can prevent this by adding link.xml files to your project – they can be placed anywhere in your Assets folder (including any subfolder) and you can add multiple to your project. The link.xml file is a simple text file that can define which code should or shouldn’t be stripped.
For example, to prevent anything in Makinom’s DLL files from being stripped, use a link.xml file with the following content:
<linker> <assembly fullname="Makinom2" preserve="all"/> <assembly fullname="Makinom2.UnityUI" preserve="all"/> </linker>
This’ll prevent Makinom and the Unity UI module from being stripped. Replace Makinom2.UnityUI with the name of the DLL file of the UI module you’re using if you use a different UI module.
Another example, to prevent a plugin from being stripped:
<linker> <assembly fullname="YourPlugin" preserve="all"/> </linker>
You might notice the pattern – put in the name of the DLL file (without .dll being added).
You can find more information on this topic and the link.xml syntax in the Unity manual.
If you’re building your project for iOS, you may run into one of the following problems.
- You are using Unity iPhone Basic. You are not allowed to remove the Unity splash screen from your game.
To fix this, change in XCode’s build settings the ‘Compress PNG files’ setting to NO and build the project again.
- Ran out of trampolines of type 2
This is caused by use of generics, you have to tell the AOT compiler allocate more trampolines. To fix this, change in Unity’s Player Settings > Other Settings the ‘AOT Compiler Options’ to nimt-trampolines=512. If you’re still receiving a trampoline error, increase the number, e.g. 1024.
This can be caused by Unity engine code being stripped when using ‘IL2CPP’ scripting backend. To fix this, disable ‘Strip Engine Code’ in Unity’s PlayerSettings > Other Settings in your iOS player settings.
- Content is displayed outside of masks
Go to ‘Edit > Project Settings > Player’ and enable ‘Use 24-bit Depth Buffer’ in the iOS ‘Resolution and Presentation’ settings in Unity.
You can find information on other issues and more detailed instructions on the Unity troubleshooting page.