block a key

how can I block a key on the keyboard? For example prevent the H key is used. The reverse is also true, allow only one key.

if (Input.GetKey (KeyCode.H) [COLOR="blue"] enabled == true[/COLOR])
{
transform.Translate(Vector3.forward * PlayerSpeed * Time.deltaTime);
}

just add another bool variable and then control the enabling/disabling with it. if that is what you need

Or you can always pull out the “H” button from your keyboard so you won’t be able to use it. Or block it with some peace of wood or something