c# - 使用 IL2CPP 在 Visual Studio 中调试 Unity Hololens?
问题描述
我正在运行 Unity 2018.2,并且在使用 IL2CPP 构建 Hololens 项目时,在 Visual Studio 2017 中,当从项目的 C# 脚本调用 Debug.Log 时,我再也看不到任何输出。
我相信我的问题与其他问题有关调试 IL2CPP 代码的最佳方法是什么?.
我已按照这些说明https://docs.unity3d.com/2018.2/Documentation/Manual/ManagedCodeDebugging.html(Visual Studio (Windows)),Hololens 的推荐工具安装(https://docs.microsoft.com/en -us/windows/mixed-reality/install-the-tools)和 Hololens 关于如何在 Unity 中构建项目的说明(https://docs.microsoft.com/en-us/windows/mixed-reality/holograms- 100 )。
使用 IL2CPP 构建时,是否还应该启用其他任何东西来查看 debug.log 输出?
解决方案
我在使用 Unity 2019.1 时也遇到了这个问题。和 Visual Studio 2019。因此,如果有人遇到问题,我设法通过将托管 Unity 调试器附加到运行在 HoloLens 上的应用程序来获得所需的调试行为,如本文所述。然后,我将我的Debug.Log
陈述更改为System.Diagnostics.Debug.WriteLine
. 基本上,你要做的是
Development Build
使用、Script Debugging
和Wait for managed debugger
选项构建您的 Unity 项目。- 确保 HoloLens 通过 WiFi 连接到您的 PC。
- 将生成的 VS 解决方案部署到 HoloLens。应用启动后,系统会要求您附加托管调试器。
- 通过 Unity 打开一个新的 VS 实例并转到
Debug -> Attach Unity Debugger
. - 在弹出窗口中选择您的 HoloLens。
然后您可以使用断点,查看输出System.Diagnostics.Debug.WriteLine
等。
推荐阅读
- php - 使用 htaccess 映射页面
- redirect - nginx通配符重定向配置
- wpf - VirtualizingPanel 不使用 WPF XAML 进行虚拟化
- haskell - 如何避免 Haskell 中的 stackoverflow 错误
- php - WP_Query 未返回用于搜索查询的 ID
- r - R - SpatialPolygons 列表中的 SpatialPolygonsDataFrame LIST
- c# - 将项目插入循环内索引为零的可观察集合仅适用于第一次迭代
- c# - 适用于 UWP 应用的 FFmpegInterop.UWP 或 VLC.MediaElement
- c# - 带有 LookUpEdit 的 PropertyInfo.SetValue() 中的 C# TargetException
- excel-formula - 当日期介于输入之间时计算工作日