Difference between revisions of "IL2CPP"
From PowerUI
(Created page with "Platforms that use IL2CPP like WebGL and optionally mobiles need some special considerations. == Nitro Compiler == Firstly, you'll need to precompile all your Nitro and remo...") |
(→Code Stripping turned on? Add Preserve) |
||
Line 7: | Line 7: | ||
== Code Stripping turned on? Add Preserve == | == Code Stripping turned on? Add Preserve == | ||
− | If you've got code stripping turned on, you'll need to '''add Preserve to the static methods that your UI uses''', otherwise they'll be stripped out. | + | If you've got code stripping turned on, you'll need to '''add Preserve to the static methods that your UI uses''', otherwise they'll be stripped out. Preserve can also be added more broadly if you want (i.e. preserve whole classes instead). |
− | You can either use [UnityEngine.Scripting.Preserve] which requires at least Unity 5.4 or [Values.Preserve] | + | You can either use [UnityEngine.Scripting.Preserve] which requires at least Unity 5.4 or [Values.Preserve]: |
<syntaxhighlight lang="csharp"> | <syntaxhighlight lang="csharp"> |
Latest revision as of 01:31, 13 March 2017
Platforms that use IL2CPP like WebGL and optionally mobiles need some special considerations.
Nitro Compiler
Firstly, you'll need to precompile all your Nitro and remove the Nitro compiler by ticking both boxes in Window > PowerUI > Nitro settings because IL2CPP errors if it encounters the libraries that the compiler uses.
Code Stripping turned on? Add Preserve
If you've got code stripping turned on, you'll need to add Preserve to the static methods that your UI uses, otherwise they'll be stripped out. Preserve can also be added more broadly if you want (i.e. preserve whole classes instead).
You can either use [UnityEngine.Scripting.Preserve] which requires at least Unity 5.4 or [Values.Preserve]:
[Values.Preserve]
public static void Hello(Dom.MouseEvent e){
// This method won't be stripped out by IL2CPP.
}