Detección de llave de la unidad
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
RyanGar46
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
if(Input.GetKey(KeyCode.Space))
{
//do somthing
}
void Update()
{
if (Input.GetKeyDown("space"))
{
print("space key was pressed");
}
}
//returns bool
//true if key was up last frame, but now is pressed
Input.GetKeyDown(KeyCode.Space)
//true while key is not pressed (key is up)
Input.GetKeyUp(KeyCode.Space)
//true while key is down
Input.GetKey(KeyCode.Space)
if(Input.GetKey(KeyCode.space))
{
print("Space key was pressed")
}
Update is called -> GetKeyDown is true (this frame only) -> isJumpPressed = true
Update is called -> GetKeyDown is false -> isJumpPressed = false
FixedUpdate is called -> isJumpPressed is false