PointerEventData.clickTime Example Please

Trying to figure out how to use PointerEventData.clicktime for use with limiting the second click time of double clicking. Here is what i have so far

    public void OnPointerEnter (PointerEventData data)
    {
        if (data.clickCount == 2) {
        }
    }

Not much i know but i couldnt for the life of me find any examples for PointerEventData.clicktime.
Thanks guys

    public void OnPointerEnter (PointerEventData data)
    {
        if (data.clickTime < 0.1f) {
            Debug.Log("A double click")
        }
    }
1 Like

Faceplam…That easy. Why do i always complicate things lol. Thank you Kindly.

For me, the clickTime returns the time when the event was created, with 3 seconds delay compared to the Time.time.
So if I ~instantly press and release the mouse button, then my code prints -3 seconds.
My code:

{
private PointerEventData e;
public void OnPointerClick(PointerEventData eventData)
{
e = eventData;
}
void Update()
{
if (e != null)
{
if (!e.eligibleForClick)
{
print("clicked" + (Time.time - e.clickTime).ToString());
e = null;
}
}
}
}```

FIXED: I have to use unscaled time instead of normal time

{
private PointerEventData e;
public void OnPointerClick(PointerEventData eventData)
{
e = eventData;
}
void Update()
{
if (e != null)
{
if (!e.eligibleForClick)
{
print("clicked" + (Time.unscaledTime - e.clickTime).ToString());
e = null;
}
}
}
}```