how to add a single touch button for mobile games?

Hello,
i want to add a touch button for my mobile game. For example when i touch it, the player shoots oder jumps.
The player already moves with the left joystick. My game is a 2D sidescroller.

Thanks for helping me!

Hey Valey14-

If you are trying to setup touch input for your character you may want to look at the base character code (ProjectNameCharacter.cpp). There is a default function setup to handle TouchStart and TouchStopped. The code in these functions can be edited for the needs you have (shooting instead of jumping in this case).

Cheers

hi, thanks for your answer but i accidentally tagged it with c++.
how does this work from blueprint scripting?

In the right-click menu of your blueprint you can find Input->Touch Input->Touch.

ok i found it, but how can i make a button with it like in the widget menu

Hello Valey14,

I have provided a link below to the UMG documentation. Click events are covered under the event section. I hope that this information helps.

Link: UMG UI Designer for Unreal Engine | Unreal Engine 5.1 Documentation

Make it a great day

Hey ,
so now i know how to create buttons in a widget Blueprint. Thanks!
But is it possible, that when i press a button, that the player jumps.
For me it actually worked for shooting. But i donĀ“t get it for jumping.

A couple of ways that you could do this would be that you could use a custom event to call the jumping function or build a jumping functionality in UMG and call it there.

Thank you so much it works!