- Home /
Time of actual showing on screen
Hi all
We are making a psychological test in Unity in which timing is crucial (measuring reaction time of people). I want to get the best approach to the actual time something appears on screen. Is it safe to assume that this is at the start of the next frame. In other words calling Time.time in the update after the one in which the object was activated.
As a guess, I would think that using a coroutine and WaitForEndOfFrame() would be the most accurate place to record time. Consider using the .Net Stopwatch class for the ti$$anonymous$$g rather than Unity's Time class. Or if you use the Time class, use Time.RealTimeSinceStartup. All guesses, I'm not sure how you would verify.
If you want to just get the time from when something pop-ups to when user perform an action you can do something like this:
private float reactionTime;
if(startCountingTime) reactionTime = 0.0f;
In update:
reactionTime += Time.deltaTime;
//That will add time passed from previous frame
And at last when player performs an action you can store this value into a List:
if(performedAction) reactionTimeLis.Add(reactionTime);
I think it's the easiest way to achieve what you want :)
Your answer

Follow this Question
Related Questions
Decrease a value over time? 2 Answers
Target frame rate between scenes 1 Answer
Time Delay Animation 1 Answer
Disable frames skipping 0 Answers
Multiple random values in one frame 1 Answer