Hello.
What i want is when user press “Enter” button, we wright current time to variable “firstTime” and when we again press “Enter” we wright current time to variable “secondTime” and then subtract “firstTime” from “secondTime”. So i want to know time between this two presses. Thanks in advice.
Try this-
float t = 0f;
void Update()
{
if(Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
{
float timeDiff = Time.time - t;
t = Time.time;
Debug.Log("Time after last pressed - "+ timeDiff +" Sec");
}
}