[C#] Both button check with delay.

Does anybody know how to check if both buttons are pressed?

Where if one button is pressed, it waits for a short time until the other button is pressed before knowing that both buttons are pressed, otherwise, that button press is going to be registered as a single button press.

It’s mainly for timing issues in a mobile game, the buttons used are UI buttons.

Thanks in advance!

I think you can use OnPointerDown() for this

using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class MyButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
public bool buttonPressed;
public void OnPointerDown(PointerEventData eventData){
     buttonPressed = true;
}
public void OnPointerUp(PointerEventData eventData){
    buttonPressed = false;
}
}

But I kinda need a time delay for this, since the case is when I press a button, I have some small amount of time before I press the other button so that it can be registered as a both

well this isn’t a good way but just a quick thought of mine, you can try coroutine, start it when pressed first button and inside coroutine check for another bool from second button and execute line based on that condition. I might be wrong tho