我正在运行 Unity 2018.2,在使用 IL2CPP 构建我的 Hololens 项目时,在 Visual Studio 2017 中,当从我的项目的 C# 脚本调用 Debug.Log 时,我再也看不到任何输出。
我相信我的问题与另一个问题 What is the best way to debug IL2CPP code? 有关.
我已按照这些说明进行操作 https://docs.unity3d.com/2018.2/Documentation/Manual/ManagedCodeDebugging.html (Visual Studio (Windows))、Hololens 的推荐工具安装 (https://learn.microsoft.com/en-us/windows/mixed-reality/install-the-tools) 以及有关如何在 Unity 中构建项目的 Hololens 说明 (https://learn.microsoft.com/en-us/windows/mixed-reality/holograms-100)。
在使用 IL2CPP 构建时,是否应该启用其他任何东西来查看 debug.log 输出?
最佳答案
我在使用 Unity 2019.1 时也遇到了这个问题。和 Visual Studio 2019。因此,如果有人遇到问题,我设法通过将托管的 Unity 调试器附加到 HoloLens 上运行的应用程序来获得我想要的调试行为,如 this 中所述。邮政。然后,我将 Debug.Log
语句更改为 System.Diagnostics.Debug.WriteLine
。基本上,您要做的是
- 使用
Development Build
、Script Debugging
和Wait for managed debugger
选项构建您的 Unity 项目。 - 确保 HoloLens 已通过 WiFi 连接到您的电脑。
- 将生成的 VS 解决方案部署到您的 HoloLens。应用程序启动后,系统会要求您附加托管调试器。
- 通过 Unity 打开一个新的 VS 实例并转到
Debug -> Attach Unity Debugger
。 - 在弹出窗口中选择您的 HoloLens。
然后您可以使用断点,查看 System.Diagnostics.Debug.WriteLine
等的输出。
关于c# - 使用 IL2CPP 在 Visual Studio 中调试 Unity Hololens?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53266538/