unity keyboard inpuut code example
Example 1: unity keyboard input
using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
}
}
Example 2: how to get keyboard input in unity
//https://docs.unity3d.com/ScriptReference/KeyCode.html - ALL KEYCODES