Answers for "unity c# get key"

C#
20

unity key detection

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

get key unity

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

if get key down unity

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
}
Posted by: Guest on January-25-2020
4

unity key detection

void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
Posted by: Guest on May-10-2020
1

unity c# get key

void Update()
{
    if (Input.GetKey("up"))
    {
        Debug.Log("up arrow key is held down");
    }

    if (Input.GetKey("down"))
    {
        Debug.Log("down arrow key is held down");
    }
}
Posted by: Guest on September-20-2021

C# Answers by Framework

Browse Popular Code Answers by Language