c# - 统一,如何在脚本中访问 EventSystem 调试信息
问题描述
当我在 pc 中调试游戏时,以下 EventSystem 对调试事件很有用
但是一些指针事件在 pc 中工作在 android 中不起作用,所以我想在 android 中获取完整的 EventSystem 信息,如果我可以在脚本中访问 EventSystem 信息,我可以在 UI 文本中显示它,那么如何访问?
解决方案
我找到了解决方案,Unity Editor 有 EventSystemEditor 类,它有以下代码:
public override void OnPreviewGUI(Rect rect, GUIStyle background)
{
EventSystem target = this.target as EventSystem;
if ((Object) target == (Object) null)
return;
GUI.Label(rect, target.ToString(), this.previewLabelStyle);
}
所以 EventSystem 预览是EventSystem.current.ToString
推荐阅读
- javascript - 如何使用 JS ES6 和 jQuery 将特定数据从本地存储加载到新页面?
- c - Scanf / Printf 意外行为
- ios - SwiftUI 列表行在点击后更改其背景颜色
- python - 使用 itertools 将数组行循环到方程中
- wpf - 在嵌套样式/DataGrid DataTemplates 中找不到参考绑定源
- c# - 异常信息:调用 C++ Dll 时出现 System.AccessViolationException
- xml - xPath Expression v1.0 [迭代器,如果有的话]
- joomla - JCE 2.8.3 错误:“服务器返回了无效的 JSON 响应”
- git - git/SourceTree 本地“分支”删除?
- mysql - 在处理 json 数据类型时,mysql 5.7 中是否存在错误?