Javatpoint Logo
Javatpoint Logo

Unity Console

The console is used to see the output of code. These outputs can be used to quickly test a line of code without having to give added functionality for testing.

Three types of messages usually appear in the default console. These messages can be related to most of the compiler standards:

  • Errors
  • Warnings
  • Messages

Errors: errors are exceptions or issues that will prevent the code from running at all.

Warnings: warnings are also issues, but this will not stop your code from running but may pose issues during runtime.

Messages: messages are outputs that convey something to the user, but they do not usually cause an issue.

Even we can have the console output our messages, errors, and warnings. To do that, we will use the Debug class.

The Debug class is a part of MonoBehaviour, which gives us methods to write messages to the console, quite similar to how you would create normal output messages in your starter programs.

These methods are:

  • Debug.Log
  • Debug.LogWarning
  • Debug.LogError

To open the console from the main menu of Unity Editor, select Windows -> General -> Console or press ctrl + shift + C.

Unity Console

By default console window is at the bottom and next to the Project tab of the Unity editor.

Unity Console

The outputs of the console are more useful to the programmer, not much more useful for the end-user or player.

Let's create a script for displaying a simple message, warning, and Error to the console. These will notify us when the space key, escape key, and delete key was pressed. For this, we will use the Debug class methods, which take in an object as a parameter, which we use a string in.


Unity Console
Next TopicUnity Sound

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA