2D movement with Buttons

I have a script (2D movement) that uses the keys ffrom my keyboard but i want to make an android game out of it with buttons on the sceen. i dont know how to do this. ```
if(isGrounded == true)
{
ExtraSprünge = ExtraSprungAnzahl;
}

if (Input.GetKeyDown(KeyCode.W) && ExtraSprünge > 0)
{
rb.velocity = Vector2.up * Sprungkraft;
ExtraSprünge–;
}else if (Input.GetKeyDown(KeyCode.W) && ExtraSprünge == 0 && isGrounded == true)
{
rb.velocity = Vector2.up * Sprungkraft;
}

You can google about “Unity touch input”.

You will find many tutorials.

Also, check out the manual - see:

But if also need directional input, you’ll probably need to create a virtual thumb stick, or you can use one from asset store…

1 Like

@eses is correct, just give it a good ol Google. I usually just go to YouTube directly but they both work. I know Brackeys has one on YouTube that is very good.

1 Like

thanks @eses @Cornysam

Btw I recommend not using Umlauts such as äöü because it can lead to problems (for example when you ZIP it for backup)

thanks this is verry usefull