The question is answered, right answer was accepted
Is it possible to take input from 2 UI buttons?
Hi, sorry for the noob question, im doing a 2D prototype for an android game, but im very newbie and i have a problem with this
i have 2 buttons 1 on the left upper corner of the screen, and one on the right upper corner, this is to rotate the player clockwise and counter-clockwise, and i want that when the player presses the 2 buttons at the same time, it will do a dash forward
but i dont seem to be able to find a way to do this, when i press the 2 buttons at the same time, they stop interacting.
is pressing 2 buttons at the same time possible?
Answer by LunaTrap · Nov 19, 2015 at 06:26 PM
no, it was not about code, after looking for an anwers, and being told by mod to stop doing noob question, i found that, on unity remote, the multi touch does not works
thats was my problem, that the ui buttons did not wanted to get press at the same time, but after doing a build to my phone, now the multi touch works, thanks a lot for you time killerstreak
Answer by killerstreak · Nov 19, 2015 at 12:17 PM
It would be nice if you posted some code at all, so we can actually see whats wrong. I have no idea how you are trying to accomplish this.
Maybe you should follow some tutorials before you ask questions, anyway. This isnt really something that you should be asking here, newby or not, it feels like you are lazy, and making us solve your problems.
I'll tell you what you would want to do tho: just use if statements, that check whether you press the buttons,
this is not actual code tho, its just illustrating the idea.
//something like
if(//code that checks button press left and button right isnt pressed)
{
rotate lef
}
else if (//code that checks button press right and button left isnt pressed)
{
rotate right
}
else if (//code that checks if both buttons are pressed)
{
dash
}
I must disagree, it is not wrong for someone to ask a basic question on Unity Forums. Searching through online tutorials for a specific answer can be tedious at best and having the ability to ask a focused and direct question is invaluable.