---
title: "User Input"
content_type: tutorial
url: "https://learn.unity.com/tutorial/user-input?language=en"
language: en
difficulty: beginner
duration_minutes: 5
unity_version:
  - "2019.3"
  - "2019.2"
  - "2019.1"
  - "2018.4"
  - "2018.3"
  - "2018.2"
  - "2018.1"
  - "2017.4"
  - "2017.3"
  - "2017.2"
  - "2017.1"
supported_unity_versions:
  - name: "2019.3"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2019.3"
  - name: "2019.2"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2019.2"
  - name: "2019.1"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2019.1"
  - name: "2018.4"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2018.4"
  - name: "2018.3"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2018.3"
  - name: "2018.2"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2018.2"
  - name: "2018.1"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2018.1"
  - name: "2017.4"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2017.4"
  - name: "2017.3"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2017.3"
  - name: "2017.2"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2017.2"
  - name: "2017.1"
    url: "https://learn.unity.com/tutorial/user-input.md?language=en&version=2017.1"
last_updated: "2026-08-14T15:17:26.000Z"
---

# User Input

Learn to read keyboard input in Update and log it to the Console with Debug.Log for basic user interaction.

In this tutorial, you will learn how to capture user keyboard input using the **Update** method and output to the console using **Debug.Log**.

## 1. User Input

[Video](https://connect-mediagw.unity.com/h1/20190523/videos/c876930b-97e6-47d1-939a-15717d688cc0_03_User_Input.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20200204/413bbaa4-46e2-4d72-8d7b-9490501360e2_03_User_Input.vtt))

## **Main.cs**

```csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Main : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        //if space key pressed down  
        //print a message

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.Log("space Key");
        }

        //if ey key held down
        //print message
        if (Input.GetKeyDown(KeyCode.E))
        {
            Debug.Log("Holding E");
        }

        //if f key is lifted up
        //print f

        if (Input.GetKeyUp(KeyCode.F))
        {
            Debug.Log("f");
        }
    }
}
```

`Debug.Log` calls may not appear in the the **Console** by default. Be sure that they are turned on before testing.

![](https://connect-mediagw.unity.com/h1/20200930/learn/images/24fac2fe-5164-4880-817d-8dd7280dcfaa_DebugLog.PNG)
