- Home /
Question by
siddhantxshirguppe · Jan 22, 2019 at 05:40 AM ·
guibuttonkeyboardkeycode
gui button to work exctly like up arrow key
So i was doing some amateur level coding where i just used input.getkey("up"), everywhere all over the game.replacing it with methods and adding references everywhere is cumbersome. Is it possible to create a gameobject which just assigns the working of up arrow key to a gui button.I.e every time i press a gui button, it is equivalent to pressing the up arrow key.,,including key release,key press and hold. etc
Comment
Answer by tormentoarmagedoom · Jan 22, 2019 at 09:30 AM
Good day.
Yea. You need to add Event trigger component to the button. There you can add functions to OnPointerEnter, OnPonterExit, OnPointeDown, etc...
If you dont know exactly how it works, i recommend you to watch some Event trigger component tutorial.
Good luck!