This issue was discussed in PR 3964, but it's too important to lose.
Currently it is difficult (if not impossible) to debug Unity behavior scripts after they've been deployed as IL2CPP to HoloLens 2. We need a step-by-step guide on how to debug scripts on device in order to track down bugs that only occur outside the editor.
From the previous discussion:
.Net backend is still available in Unity 2018 but removed in 2019.
There was a disussion (April 3 through 9th) about debugging on Holo 2. Early in that discussion there was a suggestion to use .Net backend and check the "Unity C# Projects" checkbox. It was mentioned as a temporary workaround until we had "improved debugging for 2019", though no information was provided about the improvement coming at that time. (In addition, currently MRTK is not working with Unity 2019.)
Someone mentioned this article as a guide for debugging IL2CPP at runtime, but someone else mentioned this approach is not currently working on HoloLens 2. (It was never explained why this approach isn't currently working on HoloLens 2.)
If at possible, it's critical that we get this guidance published by 5/1/2019 to support global events starting at that time.
The recommendation is currently to still use the .NET backend, since there isn't a great solution for debugging using IL2CPP other than directly reading the compiled C++ code. I think it's a great idea to have a guide, however I would say we need this when we require MRTK to run on Unity 2019, so it's not Urgency-Now.
Assigning to @keveleigh to try and drive this issue.
I'm sorry but I do need to disagree about this not being needed soon. While Unity 2018 still allows .Net back-end, MRTK _strongly_ urges devs not to use it. Please see the whole discussion and reasons for PR #3964.
If the current guidance is to use .Net Back-end, okay. But we need that documented clearly. We also need, as part of that same guidance, a commitment to a new approach starting with 2019. And it would be great if there could be some kind of hints as to what that approach might be.
I want to make sure we're all on the same page that we already have customers attempting to use Unity 2019 with MRTK. I know that is not our current target, but I would like to understand if we should be specifically instructing customers _not to use 2019_ at this time? Since we are working toward 2019 support (see #3962, #3951, #3999 and possibly more) shouldn't we also be working on the documentation / guidance for how to debug in 2019?
Again, I would sincerely like to ask for this document to be created by mid-May at the latest in support of our global hack events. Thanks for considering.
I think this is needed soon.
Hi,
Joost van Schaik put together an almost complete guide:
https://dotnetbyexample.blogspot.com/2019/03/debugging-c-code-with-unity-il2cpp.html
I think this might be a pretty good starting point for a documentation
I actually linked to that article in my original post above. As I stated there, someone internal mentioned to me that the process he outlined in that article wasn't currently working on HoloLens 2. I'm hoping @keveleigh can look into that discussion and determine what might be blocking.
Here's documentation on how to debug C# scripts in Unity: https://docs.unity3d.com/Manual/ManagedCodeDebugging.html
On UWP with IL2CPP, you just need to make sure that Internet Client, Internet Server and Private Networks capabilities are enabled in the app manifest. I works great debugging remote ARM64 laptops and HoloLens 1. I haven't tried debugging HoloLens 2 yet but I don't see why it wouldn't work.
I've opened a PR into the docs to add this guide: https://github.com/MicrosoftDocs/mixed-reality/pull/1276
Guide published at https://docs.microsoft.com/en-us/windows/mixed-reality/managed-debugging-with-unity-il2cpp. Please leave additional feedback on that guide via the "Feedback" buttons at the bottom of the page.
Most helpful comment
Guide published at https://docs.microsoft.com/en-us/windows/mixed-reality/managed-debugging-with-unity-il2cpp. Please leave additional feedback on that guide via the "Feedback" buttons at the bottom of the page.