1
\$\begingroup\$

OK so I have this code working and the methods are being called at the times I'd expected (ie. when the mouse hovers over the button and stops hovering over it)

But when I test it on an Android device, it is not possible to press both buttons at once. The only button that gets pressed is the one where the touch-down happened.

 public class EventHandlerThrust : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
 {
 public static EventHandlerThrust instanceOf;

 [HideInInspector] public bool isButtonPressed = false;

 void Start()
 {
     instanceOf = this;

 }

 public void OnPointerEnter(PointerEventData eventData)
 {
     isButtonPressed = true;
     Debug.Log("OnPointerEnter Interfaceyyyy called.");
 }

 public void OnPointerExit(PointerEventData eventData)
 {
     isButtonPressed = false;
     Debug.Log("OnPointerExit Interfaceyyyy called.");
 }
 }

So is it possible to allow the user to press both buttons by holding his thumb over both at the same time, using the Event Trigger System? Or do I have to implement some other kind of Input system?

\$\endgroup\$
1
  • \$\begingroup\$ I've researched this for many weeks, I really shocked that there isn't a way to do it already built into Unity. I mean honestly its fairly important functionality to be able to press both buttons at once if you ask me. I've tried Raycasting // Event Triggers // OnPointerEnter // OnPointerDown ... always same results. But I had minor success with Rects around the touch area. But it still doesnt work seemlessly and you have to be careful with the placement of the onscreen buttons. \$\endgroup\$ Commented Dec 5, 2017 at 16:54

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.