csharp unity choose key input

Code Example - csharp unity choose key input

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

void Update()
{
	if (Input.GetKey(your_key))
    {
    	print("your selected key was pressed");
	}
}