- Home /
button trigger events
I'm seeing some strange behavior that I hope is a misunderstanding on my part rather than a bug. I have a UI button on a screen space overlay canvas. It sends a message with a mouse click. But, oddly, it also sends the message when I hit the space bar. I have reproduced this with a new project with only the button and an object (a plane) to send the message to. The script on the plane just reports being invoked. Everything is standard - for example, the space is a Jump input option as usual. The event system inspector does not show anything happening when the space bar is pressed. What could possibly be doing this? I'm running Unity 5.2.2f1 personal on OS X El Capitan.
Never $$anonymous$$d, I just found another Answer entry that explained that buttons keep focus, so that once they are clicked, subsequent spacebar keypresses activate that button. This can be turned off by setting the button's Navigation option to None rather than the default Automatic. (I$$anonymous$$HO either the default should be None or Automatic should be smarter.)
Oops, now I just found another Answer ("change what spacebar is doing by default") that says the problem was really that the spacebar is (by default) an alternative positive keypress for "submit", and that can be removed. That sounds more relevant. Funny that setting Navigation to None also seemed to fix my problem.
Your answer
![](https://koobas.hobune.stream/wayback/20220612044539im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do i make a panel question appear when my FPSController walks through a tigger collider? 3 Answers
Unusual trouble with OnPointerClick 1 Answer
Highlighted buttons stay highlighted when I deactivate a canvas. No way to unhighlight them. 1 Answer