Are eventtriggers like OnPointerDown immediate or do they rely on update?

I’m making a scene where I need to precisely record when the mouse button is pressed. One possibility would be to use the eventtriggers system like so:

public class UIPresser : MonoBehaviour, IPointerDownHandler,
IPointerUpHandler
    {
       public void OnPointerDown(PointerEventData eventData)  // this is called on mouse click
            {
                RecordButtonPress();
            }
    }

But can anyone tell me exactly when OnPointerDown will be called? Is it actually anymore accurate to simply using Update() and Input.GetMouseButtonDown like so:

    Update(){
                If (Input.GetMouseButtonDown(0)) {
                                     RecordButtonPress();
                }

If anyone has any other ideas of an accurate way to record the time of button pressing then I would be glad to hear.

There is no real difference between the two. Unity’s scripting environment and (almost) all callbacks you get from Unity are called from the main thread. Therefore everything is “in sync” with the framerate. Input doesn’t change during a frame.

If you need more precise input timing you would have to use native means to get those events. This would of course depend on your target platform. If you target Windows standalone you can use a message hook like WH_MOUSE_LL or WH_GETMESSAGE.

Though keep in mind that hook callbacks are invoked from the system on a seperate thread. So you can’t directly interact with most parts of the Unity API.

If you don’t target windows you have to find a solution for your target platform.