Return key triggering a button OnClick?
I have a button that, when clicked, changes the colour of a game object, if I click it and then press the return or keypad enter key then Unity registers that as another mouse click and changes the colour of the object. The return key is in use to start the next scene but if I totally remove the script that detects the key press, the problem still persists. If I don't click the button first then the enter button presses aren't detected. Since I am using the return/enter key then whenever I start the new scene the colour that the user has picked then steps forward once more time because the key press steps forward to the next colour and still then loads the next scene.
Am I going mad? Can the enter/return key be completely separated from mouse clicks?
Answer by unitylicense21 · Oct 28, 2020 at 12:13 PM
@wgibbsw86 Check this, go to project setting->Input->check submit button. It ll be linked with keyboard buttons https://answers.unity.com/questions/1157285/send-ui-button-event-with-key-press-not-onclick.html