Question about mobile control!

So I want the character be able to shoot (touch screen) while moving (holding joystick). Right now I can only shoot when character isn’t moving. Can you help me plzzz

Hey there @YUHBE3! If you’re using UMG for the button, it’s likely that it’s just taking the focus. Slide into your buttons detail panel, and untick this setting and let me know if that helps!

image

I’m using default mobile joysticks, I can’t find is fousable inside ‘DefaultVirtualJoysticks’, am I on the wrong page?

So the mobile joystick layout allows you to use both joysticks at once out of the box as it’s able to accept multitouch natively, so there might be an issue with the binding itself. My answer was specifically for if you were using UMG widgets as a button on the right (ie jump/shoot etc). Are you using the right joystick as a button? How are you passing it’s axes?

no, I’m using default joysticks both left and right and using screen touch as jump/shoot. (Sorry If I am stupid, I’m new to the engine)

You’re not stupid! We’re all here learning something new every day. So to answer your question, this is going to be a bit of a lesson in how the touch system reads first, then on to the answer. So every time a new finger touches the screen it’s actually read and assigned a finger. So the first finger that goes down gets the Touch 1 index. (don’t ask why it’s not index 0 like everything else, fingers maybe?). Your input is likely checking for only the first finger that comes down. If that happens to be your movement finger you’re now all of a sudden unable to jump or shoot! So say if your input in your settings looks like this:
image

Then only the first finger that touches the screen can shoot. So thinking that, we could just set it to Touch 2 right? Well, that does work, but now you can’t jump unless you’re movement finger is down! Bit of a quirky system right?

Now on to how to correct this. The mobile HUD you have absorbs the full touch event if you have it on one of the joysticks, but it doesn’t stop the assigning of a finger. So instead of handling it via the input settings, handle it directly in the players input so you can take context and process it however you’d like. For an example, this is basically what’s set up in the first person shooter project:

This is effectively the same thing as having the input only work on touch 1, but you see you can access information about the touch to process it. If you wanted, you could just remove the branch here and process all touches that miss the UI as your input.

Now every time you touch and it doesn’t get consumed, you’ll execute that action!

Hope this helps!

I can’t thank you more holy shoot man. I don’t know why nobody in the whole internet tells you this but hope this helps to other people who have this problem too. Thank you so much!

No worries! I think it comes down to Unreal being more geared towards PC/Console development on a regular basis. Though that’s why I’m here, to help out where other questions don’t get answered!

Important note: If you do end up using buttons in your mobile HUD, that focusable tip I gave you at the beginning is for UMG button widgets. It only matters for the in game UI, menus can still allow it to take focus, and if your game can also hook up gamepads, you will need it to be able to take focus so you can use gamepads in the menu. If you ever want to get into using UMG (you will eventually), here’s the documentation. Have a great day!