Search code examples
c#unity-game-engineconsolestack-trace

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. 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).

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

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

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


Solution

  • 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.