Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# unity get key

[SerializeField] KeyCode your_key; //select a key in the inspector

void Update()
{
	if (Input.GetKey(your_key))
    {
    	print("your selected key was pressed");
	}
}
Source by newbedev.com #
 
PREVIOUS NEXT
Tagged: #unity #key
ADD COMMENT
Topic
Name
2+7 =