I made a custom version of the Endless Runner game tutorial, and I want to port it to Android phones. My problem is that I want to make 2 simple buttons or touch inputs, one that covers the whole left side of the screen, and another one that covers the other half for the A & D keys. I have been searching but I haven’t found anything that’s similar or simple enough for what I’m looking(I’m new to UE and all the answers that I found where to complex for me to understand.
Is there a simple way or an already existing blueprint to do something like this?
I would suggest using widgets for this, specifically 2D widgets. You could easily make one take up an entire half of the screen and react when pressed. If you’re unfamiliar with widgets, you can look at the following documentation to get started:
I hope this works for you and that you have a nice day.
Did the answer above assist you or have you found the solution to your issue? In the meantime, I’ll be marking this issue as resolved. Please feel free to comment if you require more assistance and the question will reopen.
Alternatively, you can override APlayerController::InputTouch that gets called when the screen is touched. Next you could check whether the input is on the left or right side of the screen like so:
const auto ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());
const auto bLeftSideOfViewport = (TouchLocation.X < (ViewportSize.X / 2));
I did this in C++, but I guess you can do something very similar in Blueprints.