Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking on a log doesn't jump to the code line but to ForwardToUnity() - Unity 2019.2.1 #52

Open
Wikzo opened this issue Aug 27, 2019 · 7 comments

Comments

@Wikzo
Copy link

Wikzo commented Aug 27, 2019

We recently upgraded from Unity 2018 to 2019.2.1. Before, when I clicked on a log, it used to go to the line in the code. Now it goes to else if(severity==LogSeverity.Error) UnityEngine.Debug.LogError(showObject); instead

`[LogUnityOnly()]
static void ForwardToUnity(UnityEngine.Object source, LogSeverity severity, object message, params object[] par)
{
object showObject = null;
if(message!=null)
{
var messageAsString = message as string;
if(messageAsString!=null)
{
if(par.Length>0)
{
showObject = String.Format(messageAsString, par);
}
else
{
showObject = message;
}
}
else
{
showObject = message;
}
}

        if(source==null)
        {
			if(severity==LogSeverity.Message) UnityEngine.Debug.Log(showObject);
            else if(severity==LogSeverity.Warning) UnityEngine.Debug.LogWarning(showObject);
            else if(severity==LogSeverity.Error) UnityEngine.Debug.LogError(showObject);
        }
        else
        {
            if(severity==LogSeverity.Message) UnityEngine.Debug.Log(showObject, source);
            else if(severity==LogSeverity.Warning) UnityEngine.Debug.LogWarning(showObject, source);
            else if(severity==LogSeverity.Error) UnityEngine.Debug.LogError(showObject, source);
        }
    }`

We are using a simple "middleman" class called CustomDebug:

`public static class CustomDebug
{

private const bool USE_UBER_LOGGER = true;

[UberLogger.StackTraceIgnore]
public static void LogWarning(string message, DebugType debugType = DebugType.Temp, UnityEngine.Object obj = null)
{
    string log = "";

    if (Application.isEditor)
        log = $"{message} [{obj?.name}] [{debugType}]";
    else
        log = $"{message} [{obj?.name}] [{debugType}] [{UnityEngine.SceneManagement.SceneManager.GetActiveScene().path}] [Frame {UnityEngine.Time.frameCount}] [{System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}]";

    if (USE_UBER_LOGGER)
        UberDebug.LogWarningChannel(obj, debugType.ToString(), log);
    else
        Debug.LogWarning(log, obj);

}

}`

@Wikzo
Copy link
Author

Wikzo commented Aug 27, 2019

Note: when I click on the log with the standard Console, it goes to the line specified above. If I click on it with Uber Console, nothing happens (it used to work in the previous Unity 2018).

@jalako
Copy link

jalako commented Oct 27, 2019

Did you find a solution now? I have the same problem.

@Wikzo
Copy link
Author

Wikzo commented Oct 27, 2019

Did you find a solution now? I have the same problem.

No :(

@bbbscarter
Copy link
Owner

Hi! Sorry for the delay - I can look at this at some point. I suspect it's nothing too difficult to fix.

@jalako
Copy link

jalako commented Dec 13, 2019

Is there any update on this issue?

@Rademanc
Copy link

Replace line 751 in UbberLoggerWindow.cs with this :
if (UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(filename, frame.LineNumber, 0 ))

@jalako
Copy link

jalako commented Apr 16, 2020

Replace line 751 in UbberLoggerWindow.cs with this :
if (UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(filename, frame.LineNumber, 0 ))

I can confirm that this fix is working for me on Unity 2019.2.6f1 on Windows 10.
The file you mean though is "UberLoggerEditorWindow.cs"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants