In Unity, the Console area is usually located along the bottom of the Unity Editor.
It is often located near the Project tab.
The Console displays messages generated by Unity and by your C# scripts.
The Console can show:
If the Console window is missing, open it from the Unity menu.
Select:
The Console window should then appear in the Unity Editor.
A C# script can send a message to the Console using:
Debug.Log("My game has started!");
When the game runs, the Console should display:
My game has started!
The Console is one of the most important tools for finding problems in your game.
If your game or script does not work correctly, check the Console first.
Errors usually indicate a problem that needs to be fixed.
Errors are normally shown with a red symbol or message.
Examples include:
Warnings usually indicate a possible problem.
Warnings are normally shown with a yellow symbol.
Your game may still run, but you should investigate the warning.
Debug messages are messages that you intentionally display from your program.
For example:
Debug.Log("Player has started.");
These messages are useful when testing and debugging your game.
using UnityEngine;
public class PlayerController : MonoBehaviour
{
void Start()
{
Debug.Log("My first Unity 2D game has started!");
}
void Update()
{
}
}
When you click Play, the Console should display:
My first Unity 2D game has started!
Over time, the Console may contain many messages.
You can click the Clear button in the Console window to remove the current messages.
This can make it easier to see new errors or messages.
If you see a red error message: