Windows Standalone IL2CPP debugging - VS solution?

Hello,

is it possible to debug the code generated by the IL2CPP build? Not by using the managed debugger, but directly by breakpointing the C++ code?

Other platforms generate VS solution which can be used for debugging, but Windows just output the source codes (and attaching to a process doesn’t seem to be enough).

Could you maybe add the generation of the VS Solution so debugging is available even with the old scripting backend?

We’re working on adding a VS solution for Windows standalone builds now. I’m not quite sure when it will be ready though. In the mean time, you can Visual Studio without an project, attach with native code to the Unity player executable, and manually open the generated C++ from your Unity project. Be sure to select the “Debug” option in the C++ Compiler Configuration setting though.

1 Like
  1. Any news about that possible solution file?
  2. If I have this solution file, could I use PGO (profile-guided optimization)?

There is an option in Unity 2019.3 (and maybe earlier versions, I don’t recall) to generate a VS solution with the generated code. I’m not sure about PGO though, that might require some additional work on the build system, which might not be exposed. But it is worth a try.

1 Like

Hi Josh!
Thanks very much for your help.

So:

  1. I could find it on Unity 2019.2.2f1

  2. Could set by script using:

    private static void SetIL2CPP(bool on)
    {
        EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.selectedBuildTargetGroup.ToString(), "CreateSolution", on.ToString());
        PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, on ? ScriptingImplementation.IL2CPP : ScriptingImplementation.Mono2x);
    }
  1. The solution generated has this bug:
    https://forum.unity.com/threads/il2cpp-compiler-limit-token-overflowed-internal-buffer.710648/#post-5422686
    For now, I just renamed it and could get it working

PS: If I get to test it with PGO, I will update here

Thanks again and best luck to everyone,