- Home /
Click Button
Hi,
I made a game with Keyboard controls, now I wanted to add a GUI, since I heared that GUI made in Unity uses a lot of performance I wanted to build my own UI by adding boxes which can be clicked.
My question is now when i have a block which should be clickable and then perform a certain task how can i do this ?
I guess the function would be OnMouseDown but how do I link OnMouseDown to a specific Keyboard Key ?
Answer by DaveA · Mar 15, 2012 at 08:43 PM
You either code specifically to look for keys, or use the Input manager to map 'soft' keys like 'fire' to mouse buttons and/or keys.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065149im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Examples of TBS/Heavily Gui-driven Games in Unity? 2 Answers
Unity UI Button touching from far distance 0 Answers
How to check if player is hovering mouse over a GUI Box 3 Answers
How to make a Hover event on GUI.Button 6 Answers
How to create a 2D line between a Game Object and the mouse? 0 Answers