- Home /
Question by
JackWeller2003 · Mar 25, 2016 at 05:54 PM ·
unity 5buttonstouchscreenbutton trigger eventsbegginer
Button key assignment?
i made a game with wasd. i want it for android without changing code. is there a way to directly assign a button for a key? (e.g. Jump button = space bar or up = w) thanks in advance!
Comment
Is it that hard to just change out key inputs for onmousedown, etc? You probably have already been over this, but I love using onmousedown.
Answer by Wolfshadow · Mar 25, 2016 at 10:33 PM
Xpressed = Input.GetKeyDown(KeyCode.X);
So you could do:
void OnMouseDown ()
{
Xpressed = Input.GetKeyDown(KeyCode.X);
}
This would act as keycode true when whatever button you have is pressed.
sorry, the code would be:
Xpressed = Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.X);
bool Xpressed
void On$$anonymous$$ouseDown ()
{ Xpressed = Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.X);
}