Using IL2CPP in development

Hello,

I’m working with Unity 2018.1.7f and I’m looking for information on how to use IL2CPP in development.

In this article it says that:

Which makes sense, but the option to switch the scripting backend, in Edit > Project Settings > Player, seems to suggest that this is just for the standalone player used in the “builds”.

3556767--286357--Screen Shot 2018-07-08 at 15.06.30.png

I can’t find anything specific about this in the docs, so my question is whether that setting also affects the development builds. To be clear, I’m referring to when I click the “play” button in the Unity Editor:

If it doesn’t, where can I find more info on what that article means by “develop your project”? Is there any way at all to use IL2CPP when “playing” the game in the Editor?

What would the recommended workflow be? Should I select IL2CPP, then build in “debug” mode, and launch the built artifact?

No, the editor uses mono always.

2 Likes

I see, thanks.

Then what’s the purpose of setting C++ Compiler Configuration to “Debug”? Is there a way to use breakpoints and locally debug a IL2CPP build?

I’ve tried to search for some documentation on this, but I haven’t found much.

If you build for iOS, the generated project is loaded in Xcode and compiled there. Thus, using a debug configuration allows you to debug the C++ generated inside Xcode. The same applies to XboxOne, where Visual Studio is used to build the generated C++ code, for example.

Starting with Unity 2018.2, they also support to debug C# code with IL2CPP builds (on some platforms):
https://discussions.unity.com/t/702946

With “You should use IL2CPP to both develop and ship your Project” they mean if you build a player during development, such as a daily build for your QA, you should use the scripting backend you are going to use for the master build. The reason for this is Mono and IL2CPP often behave differently in some ways, they have different bugs and if you test your project only with Mono and then build your master with IL2CPP, you most likely run into issue that you could have caught during development already.

Hi Peter77, thank you for the detailed answer.

I feel that this kind of explanation should be in the official docs, because at the moment it’s not very clear to beginners.

1 Like

If you haven’t done so yet, please check out the general IL2CPP docs here:

https://docs.unity3d.com/Manual/IL2CPP.html

You’re correct though, we don’t have much documentation for managed code debugging, either with Mono or IL2CPP. We’re working to improve that now, so hopefully the docs for Unity 2018.2 will include this information.

If you are looking specifically to debug the generated C++ code, check out this blog post, which does through an example:

https://blogs.unity3d.com/2015/05/20/il2cpp-internals-debugging-tips-for-generated-code/

We also did a talk about debugging generated C++ code:
https://www.youtube.com/watch?v=s7Ple1G83jc

I hope this helps!

Hi Josh, thanks.

I had already read the docs, but the video and blog posts are definitely helpful.

That’s great to her, thanks!