Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to debug Unity script

Hi, I am new to Unity and VS and help someone can help me. When I run my app in Emulator or hololens, how can I debug the script I wrote for Unity?

Best Answer

Answers

  • Options

    @Fireman,
    When you are in Visual Studio, select Debug > Start with Debugging (or press F5) and you will be able to debug these scripts. Unity scripts compile into an assembly that is loaded by your application and are able to be debugged like any other assembly.

    Thanks!
    David

  • Options

    @DavidKlineMS, thanks. But I could not find my script in VS project. SHould it be there? Without the original script file, how can I set break point?

  • Options
    HoloSheepHoloSheep mod
    edited May 2016

    @Fireman the first thing you want to double check is that on the build settings screen in Unity you have the "Unity C# Projects" checkbox checked when you build from Unity.

    Next when you open the VS solution that gets built into the App directory from the Build output, look for the "Assembly-CSharp (Universal Windows)" project in the Solution Explorer.

    Inside that project you should find the scripts that you created and worked with in Unity along with any other relevant folders from your Unity Assets directory like: HoloToolkit folder for example if you have the HoloToolKit included in your application.

    If you open any of those script .cs files in that project and add your breakpoints, the debugger should break on those lines when they are executed if you launch debugging in VS with Debug | x86 and hit the Green Arrow "Start Debugging" button with the appropriate target (emulator, Remote Machine, Device) selected.

    HTH

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options

    Got it. Thank you all.

  • Options
    evanjamesevanjames
    edited May 2016

    Can anyone please help me understand why this is happening?
    I put the snap shot from Visual studio

  • Options

    You have a space in the name of your Unity project.

  • Options
    Jimbohalo10Jimbohalo10 ✭✭✭

    @todd_bonnewell_com said:
    You have a space in the name of your Unity project.

    Yes I agree and the length of the path causes problems as well. Use something short like "C:\Unity\" instead of Documents.

  • Options

    It worked. Thank you very much.

Sign In or Register to comment.