简体   繁体   中英

Unity Hololens debugging in Visual Studio with IL2CPP?

I am running Unity 2018.2 and when building my Hololens project with IL2CPP, in Visual Studio 2017 I can no longer see any output when Debug.Log is called from my project's C# scripts.

I believe my question is related to this other question What is the best way to debug IL2CPP code? .

I have followed these instructions https://docs.unity3d.com/2018.2/Documentation/Manual/ManagedCodeDebugging.html (Visual Studio (Windows)), the recommended tool installation for Hololens ( https://docs.microsoft.com/en-us/windows/mixed-reality/install-the-tools ) and the Hololens instructions on how to build a project in Unity ( https://docs.microsoft.com/en-us/windows/mixed-reality/holograms-100 ).

Is there anything else that should be enabled to see the debug.log outputs when building with IL2CPP?

I also had this issue using Unity 2019.1. and Visual Studio 2019. So in case anybody has troubles with that, I managed to get my desired debugging behavior by attaching a managed Unity Debugger to the App running on the HoloLens as described in this post. Then, I changed my Debug.Log statements to System.Diagnostics.Debug.WriteLine . Basically, what you have to do is

  1. Build your Unity Project with Development Build , Script Debugging and Wait for managed debugger options.
  2. Make sure the HoloLens is connected to your PC via WiFi.
  3. Deploy the generated VS solution to your HoloLens. Once the App starts, you will be asked to attach a managed debugger.
  4. Open a new VS instance via Unity and go to Debug -> Attach Unity Debugger .
  5. Select your HoloLens in the Popup.

You can then use Breakpoints, see outputs of System.Diagnostics.Debug.WriteLine etc.

You don't actually need a debugger attached to see the output of Debug.Log calls. All of that output will go to the player log .

You may also want to try Debug.LogError , which will display the error message in an on-screen window in the player, when you have made a development player build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM