Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Windows Standalone IL2CPP debugging - VS solution?

Discussion in 'Experimental Scripting Previews' started by pavelkouril, Apr 4, 2018.

  1. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    129
    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?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    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.
     
    pavelkouril likes this.
  3. littledwarf

    littledwarf

    Joined:
    Dec 26, 2016
    Posts:
    11
    1) Any news about that possible solution file?
    2) If I have this solution file, could I use PGO (profile-guided optimization)?
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    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.
     
    littledwarf likes this.
  5. littledwarf

    littledwarf

    Joined:
    Dec 26, 2016
    Posts:
    11
    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:
    Code (CSharp):
    1.     private static void SetIL2CPP(bool on)
    2.     {
    3.         EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.selectedBuildTargetGroup.ToString(), "CreateSolution", on.ToString());
    4.         PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, on ? ScriptingImplementation.IL2CPP : ScriptingImplementation.Mono2x);
    5.     }
    3) The solution generated has this bug:
    https://forum.unity.com/threads/il2...erflowed-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,