обнаружение ключей единства
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
RyanGar46
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
if (Input.GetKeyDown(KeyCode.KEY))
//Triggers if Space is pressed
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
//Your code
}
}
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown("space"))
{
print("space key was pressed");
}
}
}
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