How to press button on keyboard by code?
void Update()
{
if (Input.GetKeyDown(KeyCode.H)) //When H is pressed
{
(your code)
}
}
you can replace GetKeyDown with GetKeyUp OR Just GetKey.
GetKey is when the button is held down.
How to press button on keyboard by code?
void Update()
{
if (Input.GetKeyDown(KeyCode.H)) //When H is pressed
{
(your code)
}
}
you can replace GetKeyDown with GetKeyUp OR Just GetKey.
GetKey is when the button is held down.