I’m trying to intentionally display certain debug logs in the error console window just so they stand out more during debugging.
I have:
public void Start()
{
Debug.Log("Here 1");
SpecialLog("The player opened the door");
Debug.Log ("Here 2");
}
public void SpecialLog(string msg)
{
System.Exception e = new System.Exception(msg);
throw e;
}
The message is displayed in the error console.
But, code execution stops because the exception occurred. So “Here 2” is never reached.
I can use Debug.LogWarning(“…”) to make certain logs stand out. It appears in the warning console. I want to take it a step further and put it in the error console.
A message tells the user “This thing happened”
A warning tells the user “This bad thing happened, but its cool, I got this”
An exception tells the user “This really bad thing happened. And its got me freaked out and I can’t deal with it. HELP.”
If your code can recover gracefully from a problem, then its not an exception, and should not be treated as one.
If you still want to do this Have you tried using Debug.LogError instead of explicitly throwing an exception?