Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 bpears · Jun 15, 2014 at 01:43 AM · yieldwhile

Yield (frames) VS Time.frameCount?

Is there a difference in using yield(frames) in a while(true) Vs using Time.frameCount to limit code iterations?

Comment
Add comment · Show 7
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 bpears · Jun 15, 2014 at 04:27 PM 0
Share

The while(true) makes a continous loop. So these seem similar. Ive been using while(true) method, but it would'nt be hard to switch it if the other method is safer or better, etc.

avatar image bpears · Jun 15, 2014 at 06:12 PM 0
Share

Yeah, I am talking about frames. And not just until next frame, but many frames.

avatar image bpears · Jun 15, 2014 at 06:16 PM 0
Share

Would yield return null with a frame counter be better than doing yield(frames)? Or is it also the same?

avatar image PouletFrit · Jun 15, 2014 at 06:41 PM 1
Share

yield(frames) is the same than yield null in javascript if i'm right, you can't tell him to yield for x number of frames... but I could be wrong I'm no expert in javascript

And yield(frames) in C# would just not compile...

So would will need to keep a frame counter

avatar image bpears · Jun 15, 2014 at 07:03 PM 0
Share

Ok, so is this frame counter still appropriate in a fixed update? Like, if I want different fixed update scripts to run at different speeds than my fixed time step? Thanks for your help, please convert your initial comment to an answer so i can accept!

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by PouletFrit · Jun 15, 2014 at 05:50 PM

yield return null, stop it's process until next frame, as Time.frameCount keeps track of the total frame passed since the start, either way you would need to add a variable to keep track of the number of frame passed, so no there is no difference, but if you were talking about yield return new WaitForSeconds(), yes there is, since it's time base and not frame base...

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

21 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

Related Questions

Have a function wait unitl a boolean is false 1 Answer

How can I have a while(www is loading) loop? 1 Answer

C#: Use of while loops inside of a coroutine 2 Answers

Yield position within while loop in coroutine 1 Answer

How do I fix yield not working in while loop? 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