Magic Leap Unity Zero Iteration Debugging with Visual Studio Community

Here is a procedure for debugging and stepping through code on a Unity application that is running in a Zero Iteration session on the Magic Leap device via the Magic Leap Remote. This has been tested on Visual Studio for Mac Community v7.4.3 (Build 10) that is installed using the Unity 2018.1.9f1-MLTP8.1 installer.

1) Make sure your Magic Leap is powered on and ready, then attach your Magic Leap device to your computer

2) Start the Magic Leap Remote and click "Start Device", to get the device into Zero Iteration mode.

3a) Start Unity and load your Magic Leap Unity project

3b) Within Unity, in Build Settings, in Magic Leap, be sure to enable the "Development Build" checkbox

3c) Within Unity, click on the Magic Leap menu item and enable Zero Iteration. Unity will let you know you will need to restart Unity, click Restart.

3d) After Unity has restarted then select a GameObject that already has a script attached and select Edit Script within the Inspector. This will open the Visual Studio solution for your Unity Project

4) Within Visual Studio, in the Solution Pane, right click on the top-level Project Solution item (this should be named the same as your Unity Project) and select "Debug Item". You will see that Visual Studio has entered Debug mode. You can now set break points where you need them.

5) Within Unity, click the Play button, this will load the App and start your Zero Iteration session on your device. When any of your Visual Studio breakpoints are hit, then flow of control will halt inside Visual Studio at a breakpoint and you can then inspect variables, etc.