Hi all
I have many a project on my hard disk that are decent concepts but unfinished solely because I cannot get a gamepad working on-screen satisfactorily. By that I mean , I’m using the UI Event Triggers components from Unity . So lets say I have a D-Pad on the left of screen and the two buttons A and B on the right, if the user plays and tries to press both buttons A and B without letting his thumb off the screen, it only detects one of the buttons being hit. Lets say you hold B to sprint and press A to jump, you dont want to let go off sprint… Well touch sh1t lol!
So from my memory here is list of things i have tried, non of them worked to a level I was satisfied with:
- Event Trigger components for each button (i tried ALL of them OnPointerEnter/Exit // OnPointerUp/Down // etc) - works great except not if you try press 2 at once with same thumb
- Raycasting each frame to see if ray is over a certain area of screen (which contains button) - the raycasts ignore the button, I tried 2d and 3d raycast and looking at all layers but couldnt get it to detect the buttons :[
- I got the raw touch data and created a Rectangle around the thumb press. Then used Rect.Overlap to trigger button touches – THIS WORKED BUT, it was a pain in the rear to implement and resulted in occasions where you’d get a button press even when you hadnt pressed the button (for obvious reasons)
So that was all my brain could handle, and until now I have simply limited all my mobile games around this fact (and abandoned many a project also, including one today that I think would make a great mobile game).
I can only publish Android games, currently I dont have ios publishing or PC publishing capabilities.
But I really would like to learn how to overcome this problem I have getting it to work with Android / Unity.
If anyone has a proof that they have it working (IE. YOU CAN SLIDE YOUR THUMB WHILST PRESSING BUTTON A OVER TO BUTTON B SO YOU COVER BOTH BUTTONS SEAMLESSLY) I would be hugely interested to see how it works.
Anyways, thanks for reading and Merry Christmas to all!