- Home /
Question by
GraviterX · Oct 12, 2015 at 11:45 PM ·
getkeydown
KeyCode.Enter
Hey guys. I've been having trouble figuring out how to make an if statement that detects when the "enter" key is pressed. I wrote this simple script but it won't work. Any help?
function Update() {
if(Input.GetKeyDown (KeyCode.Enter))
{
Debug.Log("Enter");
}
}
Comment
Best Answer
Answer by Konomira · Oct 12, 2015 at 11:52 PM
It's KeyCode.Return, KeyCode.Enter refers to the button on the Num Pad.
Thanks! I've tried return but I had the wrong statement
Your answer
![](https://koobas.hobune.stream/wayback/20220612041057im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Button Particle Emission 1 Answer
Get numeric key 4 Answers
How does unity focus GUI when different keys are pressed? 0 Answers
Trouble getting key down to work 1 Answer
GetKeyDown Enter button not working 1 Answer