[英](Unity Web) How to show Debug.Log in browser inspector rather then '~/Library/Logs/Unity'?
I wonder how to show Debug.Log in browser inspector rather then '~/Library/Logs/Unity'. 我不知道如何显示Debug.Log,而不是'〜/ Library / Logs / Unity'。 Since i am developing a multi-player game, now when I open two browsers, the logs are displayed in the same log file, all in a mess!
由于我正在开发多人游戏,因此当我打开两个浏览器时,日志显示在同一个日志文件中,一团糟!
btw, I see there is an option 'script debugging' in build settings but no luck. 顺便说一句,我看到在构建设置中有一个选项“脚本调试”,但是没有运气。
the way I've done this is to make a call out from Unity to the browser 我这样做的方法是从Unity向浏览器发出呼叫
(have a look at http://docs.unity3d.com/Manual/UnityWebPlayerandbrowsercommunication.html ) (请访问http://docs.unity3d.com/Manual/UnityWebPlayerandbrowsercommunication.html )
So in my Unity c# script I call 所以在我的Unity c#脚本中
Application.ExternalCall( "BrowserLog", "my log message" );
Ad in my host page javascript I have a function 主机页面中的广告javascript我有一个功能
<script type="text/javascript" language="javascript">
<!--
function BrowserLog( msg)
{
// logthe message
console.log( msg);
}
-->
</script>
Garrett's answer works fine. 加勒特的答案很好。 As an improvement you can also code like this avoiding the extra javascript function:
作为改进,您还可以像这样避免额外的javascript函数:
Application.ExternalCall( "console.log", "my log message" );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.