//Triggers if Space is pressed void Update() { if (Input.GetKeyDown(KeyCode.Space)) { //Your code } }