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

About IL2CPP Managed Debugger

Discussion in 'Experimental Scripting Previews' started by bdovaz, Mar 8, 2018.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Can you explain it better? Does it mean that we will be able to build and install an apk or ipa and attach Visual Studio to that process in the device or I'm completely wrong and it does nothing to do with this?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Eventually yes, this is correct. For many Unity versions, it has been possible to debug C# script code with Visual Studio when the Mono scripting backend is used. Starting in 2018.1, that will work with the IL2CP scripting backend as well, but only for standalone players on Windows and macOS.

    In 2018.2, we're planning to ship support for Android, iOS, and all other platforms where IL2CPP works. Then you will be able to install an apk created in Unity with IL2CPP and debug the C# code with Visual Studio.
     
    MechEthan and recursive like this.
  3. andrzej_cadp

    andrzej_cadp

    Joined:
    Jan 27, 2017
    Posts:
    18
    What about WebGL? Is it even possible?
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    It is not currently possible on WebGL. The managed debugger requires socket communication between the Unity player and the code editor (e.g. Visual Studio). It also requires multiple threads in the player. We could probably use WebSockets to handle the socket communication, but without threads in WebGL, we're stuck.
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I'm assuming this is supposed to work with all IDEs that can debug Mono, not only Visual Studio? Ie. Rider, VS Code, VS for Mac* etc?

    Also, is the setup supposed to be:
    - make a build with IL2CPP for Windows Standalone with debugging turned on
    - run it
    - attach the debugger from your code editor
    - break

    Or are there more involved steps to take?


    * It seems more and more obvious that the people who's in charge of branding at Microsoft runs on a unique mix of insanity and hate for their users. "I use Visual Studio. No, not that Visual Studio, the other one. No, not that one either, the third one".
     
    M_R likes this.
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Yes, it should work for all code editors that work with Unity. Also, your steps are correct. The behavior should be the same as the Mono scripting backend in all respects.
     
    Baste likes this.
  7. MechEthan

    MechEthan

    Joined:
    Mar 23, 2016
    Posts:
    166
    Thank you thank you thank you thank youuuuuu!
     
  8. Ponytech

    Ponytech

    Joined:
    Jun 13, 2016
    Posts:
    33
    Hello,

    I am using Unity 2018.2 and can't figure out how to debug managed code.
    I have built my project with "Script debugging" enabled, my iOS device is on the same network as my Mac (pinging works) but the player does not appear in my IDE (Jetbrains Rider)

    Any documentation / how to somewhere?
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Unfortunately we don't have great (or much) debugger documentation. I'm hoping to fix that soon.

    In the meantime, it sounds like you are doing things correctly. You might be running into a firewall issue. The debugger protocol uses TCP at a pretty high port number, so even if a ping succeeds, the connection to the player might not work. Here are a few things to try:
    • Build and Mac standalone player for both IL2CPP and Mono, make sure you can debug these.
    • Try to use the Unity profiler to profile the iOS player on your device - the debugger discovery protocol uses the same TCP connection as the profiler.
    • Try a different IDE. You can use VS for Mac or Visual Studio from a Windows machine.
     
  10. fdsagizi2

    fdsagizi2

    Joined:
    Nov 4, 2013
    Posts:
    70
    Hi, i build iOS version, with il2cpp and "Script debugging" enabled
    then connect trought Jetbrains Rider on MacOs - Run/Attach To Unity Proccess

    but when i try add some break points, Rider say - https://gyazo.com/ee05be0d6937fa36121c6a2240ed5667

    when i try do this, on MacOs Player IL2CPP version, all works fine!
     
    Last edited: Aug 14, 2018
  11. mkderoy

    mkderoy

    Unity Technologies

    Joined:
    Oct 25, 2016
    Posts:
    22
    What version of Unity are you using? The Il2CPP debugging was enabled for standalone players only on 2018.1...other players like IOS were added in 2018.2. If you are seeing trouble in 2018.2, Try the latest Rider..if there are still issues please file a bug with as much detail as you can so we can look into this.
     
  12. fdsagizi2

    fdsagizi2

    Joined:
    Nov 4, 2013
    Posts:
    70
    Case 1071236
     
    mkderoy and JoshPeterson like this.
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    If you are using a mobile phone as you iOS device, make sure that it only has one active network connection. Often, a mobile phone will have both a data connection and a Wifi connection. Remote debugging is done via a TCP socket, so if you try to connect to the data connection, that probably won't work.

    You can put the phone in airplane mode and enable Wifi. That should get it down to one network connection, and it may correct the issue you see.
     
    mkderoy likes this.