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
1
Question by adechw · Dec 15, 2015 at 09:31 AM · waitforsecondsdelaysleep

Is the delay function in unity faster than WaitForSeconds()?

I have a project that needs delay function which is not taking long time .. I have tried using WaitForSeconds() but the result takes time too long as well.

I have already given small parameter 0.0000000001f and it still the same , nothing change.

How can I get the faster delay than this function (WaitForSeconds()) ???

Thanks in advance :)

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 LazyElephant · Dec 15, 2015 at 10:13 AM 0
Share

$$anonymous$$ost processors now run at around 3 gigaherz. A time delay like the one you mentioned would only allow for 3 clock cycles of the processor. It seems like you're trying to delay for a shorter time than a processor clock cycle, which won't happen. I'm actually curious to know what would require such a short wait time.

avatar image Salmjak · Dec 15, 2015 at 11:08 AM 0
Share

I don't think that's possible. I believe the smallest delay in a coroutine is a frame. So at 60 FPS that would be 1/60th of a second. This is due to coroutines only being "updated" once per frame.

If you use a Thread() you can use Thread.Sleep(1) for milliseconds. But Thread.Sleep basically says "Wait for atleast 1 ms, but it could be 5 ms".

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by fffMalzbier · Dec 15, 2015 at 09:36 AM

What delay time are you targeting. WaitForSeconds(0f) -> next time the Coroutine checks for communion of execution -> Next frame (16.67ms on 60fps) or maybe WaitForEndOfFrame could be interesting for you

Waits until the end of the frame after all cameras and GUI is rendered, just before displaying the frame on screen.

http://docs.unity3d.com/ScriptReference/WaitForEndOfFrame.html
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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Loading Screen and Lerp 3 Answers

JS WaitForSeconds Not Working? 1 Answer

Waiting for fractions of a Second 1 Answer

Coroutine confusion 1 Answer

How do i add a delay to how often a unity ui button may be used? 1 Answer


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