How to Find the Console Area in Unity

In Unity, the Console area is usually located along the bottom of the Unity Editor.

It is often located near the Project tab.

What Does the Console Show?

The Console displays messages generated by Unity and by your C# scripts.

The Console can show:

If You Cannot Find the Console Window

If the Console window is missing, open it from the Unity menu.

Select:

The Console window should then appear in the Unity Editor.

Example: Displaying a Message

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!
    

Why Is the Console Important?

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.

Types of Console Messages

Errors

Errors usually indicate a problem that needs to be fixed.

Errors are normally shown with a red symbol or message.

Examples include:

Warnings

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

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.

How to Test the Console

  1. Open the Console window.
  2. Open your C# script.
  3. Add a Debug.Log() statement.
  4. Save your script.
  5. Return to Unity.
  6. Click the Play button.
  7. Look at the Console.

Example PlayerController Script

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!
    

Clearing the Console

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.

Using the Console to Find Errors

If you see a red error message:

  1. Read the error message.
  2. Look for the name of the script.
  3. Look for the line number.
  4. Open the script.
  5. Go to the indicated line.
  6. Correct the problem.
  7. Save the script.
  8. Return to Unity and check the Console again.
Important:

If a Unity C# script is not working, one of the first places you should check is the Console.

How the Unity Areas Work Together

Hierarchy = Objects in the current Scene

Inspector = Settings for the selected object

Project = Files and assets for the game

Console = Messages, warnings, and errors

Easy Way to Remember

Console = Messages from Unity and your program

If something is not working correctly, check the Console for errors.