Search Feedback

153
votes

Editor: Clickable Stacktrace on Unity Console

General

-

-

Especially on big games you need to create an abstraction for a Logger, and the problem is that by doing so we lose the double click on a line in the unity console to go to the code line, since when we click we go into the Logger class in the function where Debug.Log was called.

What I want is for each line in the stacktrace to be clickable and go the the line it is pointing to.

Comments (12)

  1. Ec8a9f91e27ca2ecd0fedc38ac4210cc?d=mm

    SioHio

    Jun 21, 2016 02:00

    Im very close to buying https://www.assetstore.unity3d.com/en/#!/content/11521 because this still is not possible..

  2. 7675c8fdc8445afe01ebb4f0776c45d4?d=mm

    Argl

    Jun 14, 2016 15:13

    Yes, we need this. Like...really!

  3. 1ef184756ff2918aaeb80a5ae3e61515?d=mm

    Skjalg

    Sep 11, 2015 12:24

    Throwing a MyException with the first line removed in the stacktrace takes me to where I throw the MyException.

  4. 365be149d78af8e38ce076783fef5698?d=mm

    svendkiloo

    Jan 26, 2015 13:32

    Being able to click any part of the stack trace would be a great feature, even when not using a different Logger. It would make tracing causes of a lot of errors so much easier.

  5. C75d2200d8419972d0bf46eb1dc7c781?d=mm

    Adrian LaVallee

    Jun 13, 2012 21:50

    We've figured out a way to accomplish this, though it has some limitations. By using a delegate, you can hide the call to the builtin Log functions from the callstack. Here's a rough outline:

    public class Debug
    {
    public delegate void DebugLogger(object message);

    public static DebugLogger LogNothing;
    public static DebugLogger LogDelegate;

    static Debug()
    {
    LogNothing += Nothing;
    LogDelegate += UnityEngine.Debug.Log;
    }
    static public void Nothing( object Message )
    {
    }

    static public DebugLogger Log( )
    {
    return Log (ELogType.Log);
    }
    static public DebugLogger Log( ELogType InLogType )
    {
    if (logTypeEnabled[InLogType])
    return LogDelegate;
    else
    return LogNothing;
    }

    This lets you conditionally log or not log based on the passed in enum. You could do anything else you want in the Debug.Log function, such as additional logging, or different conditional checks for whether or what type of builtin Log to call.

    The downside is you have to change your calls to Debug.Log. Instead of Debug.Log("Text"), it becomes Debug.Log()("Text") or Debug.Log(ELogType.Init)("Text"). You can't manipulate the text being logged unless you want to have an output parameter in the custom .Log that you then pass to the returned delegate, but then you have to declare the output parameter variable first and thus it is no longer a one-line log solution.

    We also made an alternative form that takes in a Unity object to pass to the version of builtin Log that accepts a gameobject for context highlighting. That had to be a separate call, though (i.e. Debug.LogObject()("Text", object); ) since you cannot overload delegates.

    Anyway, hope that helps.

  6. 1d9a5d9d01f8d4a9518960e7db41bb2e?d=mm

    Kryptos

    Jun 11, 2012 11:27

    Some work has been done during the last Ninja camp. See http://www.unity3d.com/ninjacamp/projects/10040

  7. 4a064e604be1524b49facb8c0df0e90b?d=mm

    Barry Northern

    Jun 08, 2012 11:42

    I would simply like to be able to click on any line/number entry on the stack trace and have Unity take me there. Even better would be to have a stack trace list in a separate pane of the console window (e.g. on the left), rather than the bottom pane with all the other message output.

  8. F509f2ab127d35e2b94473463dde6134?d=mm

    zhx

    Sep 24, 2011 11:18

    same problem, had to create custom debug override to prevent stacktrace lookups, actually gave noticeable performance boost on mobile! But now cant click the log messages and have them open the corresponding script, rather it opens the Static Debug override class instead :-(. Gaddy's solution might work for some, however we need the various log icons to represent their log/warning/error messages, not just as errors.

  9. 06d19d033333525f3fe533d257a2ba51?d=mm

    Guy Tidhar

    May 18, 2011 07:24

    Gaddy's solution is nice, but I have a problem with it - exception show in red. What if I'd like to decide the log level and have the plane color, yellow and red colors show for the requested log level?

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10750)

2D

(281)

Ads

(54)

AI & Navigation

(81)

Analytics

(130)

Animation

(395)

Asset Store

(355)

Asset Store Publisher

(15)

Assets

(543)

Audio

(184)

Cloud Build

(144)

Collaborate

(63)

Docs & Tutorials

(239)

Editor

(2507)

Everyplay

(17)

Game Performance Reporting

(21)

General

(978)

Graphics

(869)

GUI

(430)

Input

(172)

Licensing

(90)

Networking

(188)

Physics

(383)

Platforms

(440)

Profiling & Optimization

(84)

Runtime

(181)

Scripting

(1168)

Terrain

(170)

WebGL

(142)