简体   繁体   English

Unity控制台无法正常工作

[英]Unity console doesn't work properly

Usually, when I would print something using Debug.Log() it would show up in the console and I could double click on it to go to the function call. 通常,当我使用Debug.Log()打印某些内容时,它将显示在控制台中,并且我可以双击它以转到函数调用。 Also, a single click would expand the text to expose a kind of history of the calls (a certain function calls another function which called another one, and so on. Until the Debug.Log() was called). 同样,单击一下将扩展文本以显示调用的历史记录(某个函数调用另一个函数,该函数调用另一个函数,依此类推。直到调用Debug.Log()为止)。

But now I only get this weird behavior where the functions calls are replaced by the memory addresses of the stack. 但是现在我只得到这种奇怪的行为,其中函数调用被堆栈的内存地址所代替。

I can't post images yet so here's what the console looks like 我还不能发布图片,所以这是控制台的外观

I can still manage to find where the call occurred by expanding the message but it's a nightmare 我仍然可以通过扩展消息来找到呼叫发生的地方,但这是一场噩梦

Can you find the call? 你能找到电话吗? Hint: it's from PointCloudGenerator.cs at line 290 提示:来自PointCloudGenerator.cs的第290行

it wouldn't be so bad but the thing is that the double click behavior doesn't work at all and it's quite frustrating to try and figure out where the call originated. 情况并没有那么糟,但事实是双击行为根本不起作用,试图弄清楚呼叫的起源是非常令人沮丧的。 The exact same thing happens with warnings and errors too. 完全相同的事情也会发生警告和错误。

EDIT: I'm using Unity 5.6.3p3 and my editor is Visual Studio 2017 Enterprise 编辑:我正在使用Unity 5.6.3p3,我的编辑器是Visual Studio 2017 Enterprise

This is where the log was called: 日志被称为:

private IEnumerator ReadCornerData(long capacity, CloudBounds cloudBounds)
{
    List<Vector3> corners = new List<Vector3>();
    List<Vector3> borders = new List<Vector3>();

    using (MemoryMappedFile memoryMappedFile = MemoryMappedFile.CreateOrOpen("Global\\CornerData", capacity, MemoryMappedFileAccess.ReadWrite))
    {
        using (MemoryMappedViewAccessor accessor = memoryMappedFile.CreateViewAccessor())
        {
            byte dataAvailable = 0;
            accessor.Write(0, ref dataAvailable);
            accessor.Write((int)capacity / 2, ref dataAvailable);

            int memIndex = 0;
            while (dataAvailable != 0xF)
            {
                accessor.Read(memIndex, out dataAvailable);
                yield return new WaitForEndOfFrame();
            }
            UnityEngine.Debug.Log(dataAvailable);
        }
    }
}

` It's in a coroutine but it does the same thing when it is anywhere in my code really `在协程中,但是当它确实在我的代码中的任何地方时,它都会执行相同的操作

Right click on the Console window tab/title box and set the Stack Trace Logging to Script Only instead of Full. 右键单击“控制台”窗口的选项卡/标题框,然后将“堆栈跟踪日志记录”设置为“仅脚本”而不是“完整”。

In most cases, this should also fix the "double click to open" issue. 在大多数情况下,这还应该解决“双击打开”的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM