- Home /
Hide UnityEngine.Debug.Log(Object) in Console
Ok I did several searches as I assume this is a very common issue, but perhaps I'm not searching correctly. How do I hide the 'UnityEngine.MonoBehaviour:print(Object)' or 'UnityEngine.Debug.Log(Object)' lines in the Console???
Couldn't find an answer to the same question. There's an alternative to the standard Console in the Asset Store that offers many ways to customize the output.
There are three toggles in the upper-right of the console to hide (from left to right) messages from Debug.Log, warnings, and errors.
Are those what you're looking for?
Not sure what you are asking? What Victory described or just not show Debug.Logs? like commenting them out of the code?
// Debug.Log("do not print this");
I think he wants to remove the "UnityEngine.Debug.Log(Object)" line from the console but still keep the Debug.Log message output in console.
Answer by Anders_bp · Apr 02, 2016 at 06:12 PM
This should fix your problem :)
Doesn't that also remove stack trace logs from errors? Is there a way to only remove it from debug.log ?
@$$anonymous$$okodokoGames - Looks like as of v2017.3 you can distinguish by log level (see my answer below)
Answer by NoSoul · Jan 13, 2015 at 06:32 PM
At the end of each debug log put \n
e.g.,
Debug.Log("print this\n");
this will remove the "UnityEngine.Debug.Log(Object)"
in the output console.
The console gets cluttered with an extra line of text ("UnityEngine.Debug.Log(Object)") everytime you use Debug.Log.
So we DO want to display the Debug.Log messages in the console, but we do NOT want the extra line that says "UnityEngine.Debug.Log(Object)".
It appears NoSoul answer works by adding a \n at the end of each Debug.Log message.
So now we can see the Debug.Log message but remove that extra "UnityEngine.Debug.Log(Object)".
Thanks NoSoul
P.S.- Would be great if there was just an option to turn this on/off so you did not have to remember to put the \n each time.
Anders_bp (below) actually shows how to change the configuration so that it is no longer required to put a "\n" at the end of all logs! :)
Answer by unity_6C2raLFo_hYeHA · Mar 24, 2018 at 07:34 PM
In Unity 2017.3.1 is number of rows for Debug.Log() defined in Log Entry. Just switch to 1 Lines and it's done.
Answer by Priyanshu · Jan 07, 2015 at 05:53 PM
In the Console Window there are three Toggle Buttons at the top right corner.
Shows 'UnityEngine.MonoBehaviour:print(Object)' or 'UnityEngine.Debug.Log(Object)' lines
Shows Warning in yellow text.
Shows Errors in red text.
Highlighted version of Button signifies that it will display the content. Toggling that Button to Non-Highlighted version will stop the content from being Displayed.
As you can see in the Image below. Button under "1" is non-highlighted. Which means its disabled. Hence it stops Debug messages from being displayed.
I think this does not answer the question, which is how to hide the extraneous "UnityEngine.Debug:Log(Object)" line that shows underneath each log entry in the console. Look at Anders_bp's answer, which is correct.
Answer by mandisaw · Jan 12, 2018 at 07:55 PM
Just a heads-up, as of v2017.3, you can use the Console tab menu to selectively turn Stack Trace logging on/off for different log levels (regular/verbose, warning, assert, error, exception).
I believe the "ScriptOnly" option lets you focus only on your warnings/errors, rather than anything thrown by the system at that level.
You can also change the number of lines allowed per log-entry in the "Log Entry" option.
It gets rid of the UnityEngine.Debug.Log(Object)
but still adds a blank line LOL
This seems to break the ability to double click on a debug line in the console and have it show me the line of code that produced it in Rider.
@ohthepain Actually, I found out adding "\n" is really just adding a "new line" under the print output and pushing the "UnityEngine.Debug.Log(Object)" text down one line in the console. (The default console setting is to only show two lines.) Effectively, this is just hiding the "UnityEngine.Debug.Log(Object)" text from view. A clever trick but not exactly a solution to "eli$$anonymous$$ate the line from the log".
Yes, not really a solution. You know that you can resize the console window to any size? You can also move the splitter line inside the console window.
btw your "discovery" is already mentioned in the "second best" answer by NoSoul above. Anyone reading seeing this answer by mandisaw, you should really upvote this one. Time has changed and the other answers are essentially outdated.