Answers for "how to get key input in unity"

C#
20

unity key detection

if (Input.GetKeyDown(KeyCode.Space))
        {
            print("space key was pressed");
        }
Posted by: Guest on January-17-2020
8

unity get key down

// KeyCode.Space : The key you press
// GetKeyDown : Is true once, when the key is pressed 
// If you want it to be true WHILE the key is pressed, try GetKey() instead
if(Input.GetKeyDown(KeyCode.Space))
{
	// Do something
}
Posted by: Guest on November-29-2020
3

how to get key input in unity

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKey("up"))
        {
            print("up arrow key is held down");
        }

        if (Input.GetKey("down"))
        {
            print("down arrow key is held down");
        }
    }
}
Posted by: Guest on February-15-2021
10

get key unity

if(Input.GetKey(KeyCode.Space))
{
	//do somthing
}
Posted by: Guest on May-17-2020
3

unity getkey keycode

Input.GetKey(KeyCode.Space))
Posted by: Guest on February-20-2020
0

how to get keyboard input in unity

//https://docs.unity3d.com/ScriptReference/KeyCode.html - ALL KEYCODES
Posted by: Guest on February-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language