如何调试 AirConsole Unity 快速示例

How to debug AirConsole Unity quick example

我已经按照 http://developers.airconsole.com/#/guides/unity 上的说明进行操作,并且我可以在有和没有调试视图的情况下开始,但似乎根本没有发送任何消息(MonoBehaviour [=13= 中的 OnMessage 方法) ] 永远不会被调用)。 有没有办法调试这个问题?

您可以通过将 console.logs 添加到您的 controller.html 来调试控制器。

假设您的控制器上有一个调用 myButtonFunction 的按钮元素。

<button id = "myButton" ontouchstart="myButtonFunction()">Send A Message to Screen</button>  

然后您向该函数添加一个日志以查看按钮按下是否正常。

var myButtonFunction = function() {
       console.log("myButton was pressed");
       airconsole.message(AirConsole.SCREEN, "button-pressed");
};

要查看控制器记录的内容,您需要使用启动模式 'Virtual Controllers' 并打开浏览器的开发人员控制台。