Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Write in Unity Console | Write your First Script
Unity for Beginners
course content

Course Content

Unity for Beginners

Unity for Beginners

1. Unity Introduction
2. Write your First Script
3. Unity Physics
4. Unity UI and Sounds
5. Polishing and Export your Game

book
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?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 1
We're sorry to hear that something went wrong. What happened?
some-alt