Course Content
Unity for Beginners
Unity for Beginners
Write in Unity Console
We have already seen how to write on the console in the previous lesson, but today we will learn how to have more control over it and how to use it properly. If you forget how to write on the console, here's how.
Debug.Log : log general information messages. It's commonly used for debugging purposes to track the flow of the program.
Debug.LogWarning : log warning messages. warnings indicate potential issues or unexpected behavior.
Debug.LogError : log error messages. Errors indicate critical issues or bugs in the code that need immediate attention.
This is the console panel that we will explore.
Clear: Clearing the console if there are logs already present. If you click the arrow next to "clear," we have these options.
You can select any one of them: if you want the console to be cleared automatically after playing the build or recompiling.
Collapse: Collapsing in Unity's console organizes messages by type, condensing them into collapsible groups. It makes debugging easier by focusing on specific message categories for efficient navigation. For example, consider this code:
This the result with collapse on:
And this is the result with collapse off:
Error Pause: When enabled, this feature pauses the game upon encountering an error while playing.
Display the number of logs. When you click on them, you can show or hide messages. You can also find this documentation on Unity's website: Console
Everything was clear?