统一说明如何在脚本中访问EventSystem调试信息

时间:2018-12-07 11:01:11

标签: c# android unity3d

当我在PC中调试游戏时,以下EventSystem对调试事件很有用 enter image description here

但是某些指针事件在pc中不能在android中工作,所以我想在android中获得完整的EventSystem信息,如果我可以在脚本中访问EventSystem信息,则可以在UI文本中显示它,那么如何访问?

2 个答案:

答案 0 :(得分:0)

我找到了解决方案,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

结果是这样的: enter image description here

答案 1 :(得分:0)

您也可以使用文本设置值。


    return db.collection("users").doc(userid).collection("files").doc(id).get().then(function(doc) {
          console.log("Loaded DB");
          project = doc.data();
          return { "data": "to send to the client" };
    }