Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lesockmonkey · Sep 19, 2019 at 03:15 AM · timetimertimer-script

How to create an accurate timer in Unity?

Hey, I'm looking for a way to make a high-accuracy and reliable timer in Unity. I'm looking to use it for psychology research, because I'm relatively good at Unity compared to other programs, but this kind of accuracy is beyong my skill level.

I'm looking for at least 5 decimals after seconds, that is precision to the 0.00001 second. (preferably even 6 decimals but 5 is enough) Of course, it also has to be reliable accross machines.

I've looked at a few things but the accuracy isn't even close to this so I'd appreciate whatever ideas you might have.

Thanks!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image WarmedxMints · Sep 19, 2019 at 04:29 AM 0
Share

For the most part, code execution in Unity is framerate dependent and running threads can be a pain. As you likely know C#, you would likely be better off writing a C# app for the task.

avatar image yugen1 · Jan 29, 2021 at 01:07 PM 0
Share

Did you find any solution for that @Lesockmonkey ? I need it for similar research purposes too. Thanks!

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Xarbrough · Sep 19, 2019 at 09:05 AM

Timing with high accuracy is a larger issue in itself, not so much Unity specific, I'd say. You can star your own thread in Unity and start counting time, but you will always run into troubles caused by performance hiccups caused by the operating system, for example. And of course the timer itself is not of much unless you can start and stop it accurately, but user input and graphical UI will need to sync to the main thread in most common applications, so you probably need specific hardware support, e.g. a button or LED lights which trigger at high precision.

All in all I wonder, why you would need this precision for you experiment. I by no means know much about the field, but for example, human reaction time is much more in the region of 0.2 seconds, and this is precision we can simply to in Unity either with a high and stable framerate on the main thread or with a timer running on the second thread, and simply accepting some error when starting and stopping the timer via UI.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

116 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

timer not ticking down 2 Answers

How do I make a Countdown Timer in Minutes and Seconds only 1 Answer

How to make this display milliseconds? 3 Answers

Timer ends game 1 Answer

How do I stop 'timeSinceLevelLoad' without pausing entire game? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges