Touch Buttons?

I’ve tried to look around for a while now to find anything on how to do proper Touch Buttons as compared to Touch Joysticks.

I’m doing a Side Scrolling Endless Flying game and the precision needed to survive just can’t be achieved with the standard virtual thumb joystick.
When I play it on the PC the keys I press gives a constant 1 or -1 depending on whether I press Up or Down whereas the Joystick goes between 0.0 to 1.0 or 0.0 to -1.0. While this is how a normal joystick works (deadzones and all) this is not desirable for my game. I’d like to have touch buttons that work the same as my keyboard buttons. Fast and Precise.

But achieving this have so far been a big problem. I first tried to achieve it through UMG but that failed.
Then I tried to achieve it by making touch buttons but I could never configure the Touch Interface to the point where it works like buttons. It’s still just Joysticks.
I would really appreciate any help with this, as it’s paramount to making my game enjoyable :slight_smile:

Does no know still don’t know anything about touch controls?

This seems like a heavily under-developed part of the Unreal Engines mobile department.

UMG is the way to do this. Did you start a thread asking about the problems you encountered?

Quite a while ago: Joystick Control help - Blueprint - Epic Developer Community Forums
There seems to be no help on how to do Touch Buttons that work like you’d expect a button on a keyboard or keypad to work. I tried to do it through UMG but I only ran into “Infinite Loop” stack problems.

Nothing in that thread about UMG. Buttons in UMG work like normal buttons, you just call a function when they’re pressed and released to tell the player to run/jump whatever.

Yeah, that doesn’t work. I press the button I made (Using the OnPress Event) and the ship I got moves 1 unit along the Z axis when it’s supposed to keep moving as I hold down the button. I have to repeatedly tap it to move.

Press is only fired once until it has been released. Sounds like an issue with your game code, what are you doing after a button is pressed? Are you setting a bMove variable to true when pressed and updating the location every frame?

Why is there no event for when you keep pressing? When I press a keyboard button I don’t have to do any fancy variable modification to make it work. I just do this:

cc47bb82647e114f444be867261e70f1e82c0251.jpeg

That event will fire regardless, if you aren’t pressing it the axis value is 0. You can store a boolean that is set to true when you press the button, and false when you release. As long as that bool is true you know the player is holding the button down.

I want to deploy this on mobile. The Joystick doesn’t cut it. I need touch buttons.
There are no touch buttons. UMG is how to do it you tell me. But there are only roundabout weird ways of pulling off continuous button pressing.

There are no accessible Input Action nodes in my UMG blueprint.

So you got nothing…?

Look, I don’t have any experience with mobile dev. You need to do more troubleshooting. Is the axis value not printing anything at all on touch. Do you even see the buttons on the screen? Why haven’t you tried this with UMG yet? Maybe this is a bug but I haven’t seen you post on answerhub yet. There are probably a million other things that you’re going to have to try and figure out. We can only help so much. And remember we all volunteer our time here to help and answer questions…

In the opening post I wrote:

There are no “Pressed” and “Released” executive pins on any nodes you can spawn in the UMG section of the editor, like there is in the blueprint editor for my Character. While I understand this is voluntary, not even the Developers of the Engine it seems, know the answer to this particular problem of wanting Touch Buttons. It’s just a bit confusing to me, considering Epic Games seems to have wanted to push their engine to Mobile for a while. I get that it’s new territory for the Unreal Engine, but it just seems like a big oversight when you think about it.

Hello Vipar,

If you are looking for a simple button click and hold that you can apply to the screen I have an example that you can try. This example may be viable depending on your needs, if I understood what it was that you are looking for. I hope that this information helps.

Example:

I have created a new widget blueprint and I have simply added a button to the designer tab. I then created an OnPressed and an OnReleased event for this button. From there I used a gate to open and close a loop that runs as long as the button is held down. The print string in the example is where you would run the desired function. The delay can be altered to fine tune how quickly you would like the button to repeatedly fire off while the button is down.

Make it a great day

I will give this a try and report back. When I tried to do something similar myself I ran into infinite loop errors.

Nope, Infinite Loop just like when I tried this before.

In the Character Blueprint (Spaceship) I have this:

In the UMG Blueprint I have this:

As Soon as I press the On Screen button, the game instantly crashes with an Infinite Loop error.

The Delay is critical to preventing it from looping forever on a single frame.

Okay, that seems to work.

Thank you for the help. I may seem somewhat angry from my previous posts, but know that it’s frustration over not being able to do what I needed to do. Considering how easy it is to do so many other things in the engine, this just stunned me.

Thanks again.

Hello , I have same problem, been working on it since 2 days …
here are screen shots


I have created Object Reference of PhysicsBallBp(BluePrint Pawn class) in HUD(Widget Blueprint Class)
then i use its event to be executed.
i dont know where i am doing wrong… kindly help

Would have been better if you made your topic on this.