capture/record data between interval

Hi,
Anybody know how to measure and record data in between interval?

let’s say i am using unity to create a numbering tapping game and there’s 4 numbers (1,2,3,4) and they are all in box form. and i want to know how long it take for player to tap one number after another? want to measure and record the interval/inbetween time player take to tap from number 1 to 2, 2 to 3.

new to this unity software, hope to seek some help for this project. thank you : )

When the user makes the first tap, record t = Time.time. When the user taps again, you have (Time.time - t) as the time between taps.

hi sir, then may i know where should i put this code under?

In a script.

You’ll need some variables to store these values in. I’d probably have some List or Stack object to store the values in as they get pressed. As well as a var representing which key we’re waiting for.

In the Update event you’d then test if the next value was tapped.

If it were, you’d record the time, and set the var for the next value to listen to to the next value in the order.

1 Like

Guess you need to follow the Learn tutorials that give you a basic kick-start in c# programming.